fn | Function | A function to bind to the focus event on each of the matched elements. |
---|
Bind a function to the focus event of each matched element.
<p>Hello</p>
$("p").focus( function() { alert("Hello"); } );
<p onfocus="alert('Hello');">Hello</p>
Trigger the focus event of each matched element. This causes all of the functions that have been bound to thet focus event to be executed.
<p onfocus="alert('Hello');">Hello</p>
$("p").focus();
alert('Hello');
fn | Function | A function to bind to the focus event on each of the matched elements. |
---|
Bind a function to the focus event of each matched element, which will only be executed once. Unlike a call to the normal .focus() method, calling .onefocus() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).
<p onfocus="alert('Hello');">Hello</p>
$("p").onefocus( function() { alert("Hello"); } );
alert('Hello'); // Only executed for the first focus
fn | Function | A function to unbind from the focus event on each of the matched elements. |
---|
Removes a bound focus event from each of the matched elements. You must pass the identical function that was used in the original bind method.
<p onfocus="myFunction">Hello</p>
$("p").unfocus( myFunction );
<p>Hello</p>
Removes all bound focus events from each of the matched elements.
<p onfocus="alert('Hello');">Hello</p>
$("p").unfocus();
<p>Hello</p>
fn | Function | A function to bind to the blur event on each of the matched elements. |
---|
Bind a function to the blur event of each matched element.
<p>Hello</p>
$("p").blur( function() { alert("Hello"); } );
<p onblur="alert('Hello');">Hello</p>
Trigger the blur event of each matched element. This causes all of the functions that have been bound to thet blur event to be executed.
<p onblur="alert('Hello');">Hello</p>
$("p").blur();
alert('Hello');
fn | Function | A function to bind to the blur event on each of the matched elements. |
---|
Bind a function to the blur event of each matched element, which will only be executed once. Unlike a call to the normal .blur() method, calling .oneblur() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).
<p onblur="alert('Hello');">Hello</p>
$("p").oneblur( function() { alert("Hello"); } );
alert('Hello'); // Only executed for the first blur
fn | Function | A function to unbind from the blur event on each of the matched elements. |
---|
Removes a bound blur event from each of the matched elements. You must pass the identical function that was used in the original bind method.
<p onblur="myFunction">Hello</p>
$("p").unblur( myFunction );
<p>Hello</p>
Removes all bound blur events from each of the matched elements.
<p onblur="alert('Hello');">Hello</p>
$("p").unblur();
<p>Hello</p>