I have a form. Outside that form, I have a button. A simple button, like this: <button>My Button</button>Nevertheless, when I click it, it submits the form. Here's the code: <form id="myform"> <input /> </form> <button>My Button</button>All this button should do is some JavaScript. But even when it looks just like in the code above, it submits the form. When I change the tag button to span, it works perfectly. But unfortunately, it needs to be a button. Is there any way to block that button from submitting the form? Like e. g. <button onclick="document.getElementById('myform').doNotSubmit();">My Button</button>