Lea Verou 19.05.2018

Never forget type="button" on generated buttons!

Przeczytaj oryginał

The author details a perplexing bug where hitting 'Enter' in a form text field, built with the Mavo framework, was deleting items instead of adding them. The root cause was that dynamically generated <button> elements without an explicit type attribute default to 'submit' inside a form. This caused the first button (a delete button) to be triggered on form submission attempts. The article explains the HTML specification quirk and recommends always adding type="button" to library-generated buttons to prevent such issues.

Never forget type="button" on generated buttons!

komentarzy

Brak komentarzy

Bądź pierwszy, który podzieli się swoimi myślami!

Rozszerzenie przeglądarki

Uzyskaj natychmiastowy dostęp do AllDevBlogs z przeglądarki

Tydzień

No top articles yet