I'm having trouble adding an event on a button that submits the form and after submission stopping the page redirect. I found other answers where I tried adding return false and preventDefault but neither are working.
Why is this not working?
function submitform() {
document.getElementById("form").submit( function () {
return false;
});
}
I added the click event to the button
<button id="button" onclick="submitform();">Submit Form</button
Here is an example that shows the javascript not working.