Answers for "get form element from submit event"

5

js form submit listener

document.getElementById("#myFormId").addEventListener("submit", function(e){
    if(!isValid){
        e.preventDefault();    //stop form from submitting
    }
  	//do whatever an submit the form
});
Posted by: Guest on September-30-2020
8

javascript prevent form submit

<form name="foo" onsubmit="return false">
Posted by: Guest on March-04-2020

Code answers related to "get form element from submit event"

Code answers related to "Javascript"

Browse Popular Code Answers by Language