Never forget type="button" on generated buttons!
Read OriginalThe 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.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser