There are a few similar questions to this but none quite the same.
I want to know if there is an event that can be used to execute some JS before a page is submittin
Something like this?
function do_something(){ // Do your stuff here }
If you put return like the code below, you can prevent the form submission by returning false from the do_something() function.
return
do_something()
function do_something(){ // Do your stuff here return true; // submit the form return false; // don't submit the form }