I have a form like:
<form method="POST" action="page.html" onsubmit="alert('foo'); // validate();" name="foobar">
...
</form>
and a link like:
<div onclick="document.foobar.submit();">click me</div>
How can I capture the submit() method and call my validate function?
You can call method from html itself. modified jsbin. Instead of submitting form on click you can call
submitHandlerand pass form reference.