fn | Function | A function to bind to the submit event on each of the matched elements. |
---|
Bind a function to the submit event of each matched element.
Prevents the form submission when the input has no value entered.
<form id="myform"><input /></form>
$("#myform").submit( function() { return $("input", this).val().length > 0; } );
Trigger the submit event of each matched element. This causes all of the functions that have been bound to thet submit event to be executed.
Note: This does not execute the submit method of the form element! If you need to submit the form via code, you have to use the DOM method, eg. $("form")[0].submit();
Triggers all submit events registered for forms, but does not submit the form
$("form").submit();
fn | Function | A function to bind to the submit event on each of the matched elements. |
---|
Bind a function to the submit event of each matched element, which will only be executed once. Unlike a call to the normal .submit() method, calling .onesubmit() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).
<p onsubmit="alert('Hello');">Hello</p>
$("p").onesubmit( function() { alert("Hello"); } );
alert('Hello'); // Only executed for the first submit
fn | Function | A function to unbind from the submit event on each of the matched elements. |
---|
Removes a bound submit event from each of the matched elements. You must pass the identical function that was used in the original bind method.
<p onsubmit="myFunction">Hello</p>
$("p").unsubmit( myFunction );
<p>Hello</p>
Removes all bound submit events from each of the matched elements.
<p onsubmit="alert('Hello');">Hello</p>
$("p").unsubmit();
<p>Hello</p>
fn | Function | A function to bind to the select event on each of the matched elements. |
---|
Bind a function to the select event of each matched element.
<p>Hello</p>
$("p").select( function() { alert("Hello"); } );
<p onselect="alert('Hello');">Hello</p>
Trigger the select event of each matched element. This causes all of the functions that have been bound to thet select event to be executed.
<p onselect="alert('Hello');">Hello</p>
$("p").select();
alert('Hello');
fn | Function | A function to bind to the select event on each of the matched elements. |
---|
Bind a function to the select event of each matched element, which will only be executed once. Unlike a call to the normal .select() method, calling .oneselect() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).
<p onselect="alert('Hello');">Hello</p>
$("p").oneselect( function() { alert("Hello"); } );
alert('Hello'); // Only executed for the first select
fn | Function | A function to unbind from the select event on each of the matched elements. |
---|
Removes a bound select event from each of the matched elements. You must pass the identical function that was used in the original bind method.
<p onselect="myFunction">Hello</p>
$("p").unselect( myFunction );
<p>Hello</p>
Removes all bound select events from each of the matched elements.
<p onselect="alert('Hello');">Hello</p>
$("p").unselect();
<p>Hello</p>
fn | Function | A function to bind to the change event on each of the matched elements. |
---|
Bind a function to the change event of each matched element.
<p>Hello</p>
$("p").change( function() { alert("Hello"); } );
<p onchange="alert('Hello');">Hello</p>
Trigger the change event of each matched element. This causes all of the functions that have been bound to thet change event to be executed.
<p onchange="alert('Hello');">Hello</p>
$("p").change();
alert('Hello');
fn | Function | A function to bind to the change event on each of the matched elements. |
---|
Bind a function to the change event of each matched element, which will only be executed once. Unlike a call to the normal .change() method, calling .onechange() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).
<p onchange="alert('Hello');">Hello</p>
$("p").onechange( function() { alert("Hello"); } );
alert('Hello'); // Only executed for the first change
fn | Function | A function to unbind from the change event on each of the matched elements. |
---|
Removes a bound change event from each of the matched elements. You must pass the identical function that was used in the original bind method.
<p onchange="myFunction">Hello</p>
$("p").unchange( myFunction );
<p>Hello</p>
Removes all bound change events from each of the matched elements.
<p onchange="alert('Hello');">Hello</p>
$("p").unchange();
<p>Hello</p>