Disable form auto submit on button click

I have a HTML form where I use several buttons. The problem is that no matter which button I click, the form will get submitted even if the button is not of type “submit”. e.g. Buttons like :<button>Click to do something</button>, result in form submission.

It’s quite painful to do an e.preventDefault() for each one of these buttons.

I use jQuery and jQuery UI and the website is in HTML5.

Is there a way to disable this automatic behavior?

6 Answers
6

Leave a Comment