<form onSubmit="return validate(this)"
Just return false to stop sending
you can add a function to window.onload too:
window.onload=function() { document.getElementsByTagName("form")[0]).onsubmit=function() { return validate(this); } } function validate(theForm) {
If you want to follow the latest best practices, you will use addEventListener or attachEvent or jQuery bind
Comment by @BrendanEich :
@mplungjan onclick submit just drops out of this button; the onsubmit form is clearly better.
source share