Friday, October 7, 2011

submit(Function)

submit(Function fn) returns jQuery

Bind a function to the submit event of each matched element.

Example:

Prevents the form submission when the input has no value entered.

$("#myform").submit( function() {
return $("input", this).val().length > 0;
} );

HTML:

<form id="myform"><input /></form>

No comments:

Post a Comment