I have a form that has a submit button in it somewhere.
However, I would like to somehow \'catch\' the submit event and prevent it from occurring.
Is there s
You can use inline event onsubmit
like this
Or
Demo
Now, this may be not a good idea when making big projects. You may need to use Event Listeners.
Please read more about Inline Events vs Event Listeners (addEventListener and IE's attachEvent) here. For I can not explain it more than Chris Baker did.
Both are correct, but none of them are "best" per se, and there may be a reason the developer chose to use both approaches.