Published
- 1 min read
js form submit listener
The solution for this is noted below
js form submit listener
Solution
document.getElementById("#myFormId").addEventListener("submit", function(e){
if(!isValid){
e.preventDefault(); //stop form from submitting
}
//do whatever an submit the form
});
Try other methods by searching on the site. That is if this doesn’t work