Monday, 9 September 2013

Bind two function to same button

Bind two function to same button

Its valid to do something like:
<form id="legalopt">
<button type="submit" id="confirmopt" onclick="function2();">Click
ME!</button>
</form>
$('#legalopt').submit(function(e){
e.preventDefault();
function1();
}
As you can see, funcion1 is fired when the form is submitted by the submit
button and also function2 is called because the onlick call of the button.
Is this valid? Is cross-browser compatible?

No comments:

Post a Comment