Let's say I have the following HTML:
<form> ...some form fields... <input type="submit" id="submitButton" value="Submit" /> </form>
And I have a javascript validate method that checks form fields for various invalid scripts, returning true if all is well or false if something is wrong.
Is there any real jQuery difference between this:
$("form").submit(function() { return validate(); });
... or do the following:
$("#submitButton").click(function(){ return validate(); });
And are there any advantages / disadvantages between the two?
jquery submit forms
Aj.
source share