jQuery website jQuery documentation

Events / Mouse

dblclick(Function fn) : jQuery

fnFunctionA function to bind to the dblclick event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").dblclick( function() { alert("Hello"); } );
Result
<p ondblclick="alert('Hello');">Hello</p>

dblclick() : jQuery

Trigger the dblclick event of each matched element. This causes all of the functions that have been bound to thet dblclick event to be executed.

Example

Before
<p ondblclick="alert('Hello');">Hello</p>
Code
$("p").dblclick();
Result
alert('Hello');

onedblclick(Function fn) : jQuery

fnFunctionA function to bind to the dblclick event on each of the matched elements.

Bind a function to the dblclick event of each matched element, which will only be executed once. Unlike a call to the normal .dblclick() method, calling .onedblclick() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p ondblclick="alert('Hello');">Hello</p>
Code
$("p").onedblclick( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first dblclick

undblclick(Function fn) : jQuery

fnFunctionA function to unbind from the dblclick event on each of the matched elements.

Removes a bound dblclick event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p ondblclick="myFunction">Hello</p>
Code
$("p").undblclick( myFunction );
Result
<p>Hello</p>

undblclick() : jQuery

Removes all bound dblclick events from each of the matched elements.

Example

Before
<p ondblclick="alert('Hello');">Hello</p>
Code
$("p").undblclick();
Result
<p>Hello</p>

mouseup(Function fn) : jQuery

fnFunctionA function to bind to the mouseup event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").mouseup( function() { alert("Hello"); } );
Result
<p onmouseup="alert('Hello');">Hello</p>

mouseup() : jQuery

Trigger the mouseup event of each matched element. This causes all of the functions that have been bound to thet mouseup event to be executed.

Example

Before
<p onmouseup="alert('Hello');">Hello</p>
Code
$("p").mouseup();
Result
alert('Hello');

onemouseup(Function fn) : jQuery

fnFunctionA function to bind to the mouseup event on each of the matched elements.

Bind a function to the mouseup event of each matched element, which will only be executed once. Unlike a call to the normal .mouseup() method, calling .onemouseup() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onmouseup="alert('Hello');">Hello</p>
Code
$("p").onemouseup( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first mouseup

unmouseup(Function fn) : jQuery

fnFunctionA function to unbind from the mouseup event on each of the matched elements.

Removes a bound mouseup event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onmouseup="myFunction">Hello</p>
Code
$("p").unmouseup( myFunction );
Result
<p>Hello</p>

unmouseup() : jQuery

Removes all bound mouseup events from each of the matched elements.

Example

Before
<p onmouseup="alert('Hello');">Hello</p>
Code
$("p").unmouseup();
Result
<p>Hello</p>

mouseout(Function fn) : jQuery

fnFunctionA function to bind to the mouseout event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").mouseout( function() { alert("Hello"); } );
Result
<p onmouseout="alert('Hello');">Hello</p>

mouseout() : jQuery

Trigger the mouseout event of each matched element. This causes all of the functions that have been bound to thet mouseout event to be executed.

Example

Before
<p onmouseout="alert('Hello');">Hello</p>
Code
$("p").mouseout();
Result
alert('Hello');

onemouseout(Function fn) : jQuery

fnFunctionA function to bind to the mouseout event on each of the matched elements.

Bind a function to the mouseout event of each matched element, which will only be executed once. Unlike a call to the normal .mouseout() method, calling .onemouseout() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onmouseout="alert('Hello');">Hello</p>
Code
$("p").onemouseout( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first mouseout

unmouseout(Function fn) : jQuery

fnFunctionA function to unbind from the mouseout event on each of the matched elements.

Removes a bound mouseout event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onmouseout="myFunction">Hello</p>
Code
$("p").unmouseout( myFunction );
Result
<p>Hello</p>

unmouseout() : jQuery

Removes all bound mouseout events from each of the matched elements.

Example

Before
<p onmouseout="alert('Hello');">Hello</p>
Code
$("p").unmouseout();
Result
<p>Hello</p>

click(Function fn) : jQuery

fnFunctionA function to bind to the click event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").click( function() { alert("Hello"); } );
Result
<p onclick="alert('Hello');">Hello</p>

click() : jQuery

Trigger the click event of each matched element. This causes all of the functions that have been bound to thet click event to be executed.

Example

Before
<p onclick="alert('Hello');">Hello</p>
Code
$("p").click();
Result
alert('Hello');

oneclick(Function fn) : jQuery

fnFunctionA function to bind to the click event on each of the matched elements.

Bind a function to the click event of each matched element, which will only be executed once. Unlike a call to the normal .click() method, calling .oneclick() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onclick="alert('Hello');">Hello</p>
Code
$("p").oneclick( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first click

unclick(Function fn) : jQuery

fnFunctionA function to unbind from the click event on each of the matched elements.

Removes a bound click event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onclick="myFunction">Hello</p>
Code
$("p").unclick( myFunction );
Result
<p>Hello</p>

unclick() : jQuery

Removes all bound click events from each of the matched elements.

Example

Before
<p onclick="alert('Hello');">Hello</p>
Code
$("p").unclick();
Result
<p>Hello</p>

mousemove(Function fn) : jQuery

fnFunctionA function to bind to the mousemove event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").mousemove( function() { alert("Hello"); } );
Result
<p onmousemove="alert('Hello');">Hello</p>

mousemove() : jQuery

Trigger the mousemove event of each matched element. This causes all of the functions that have been bound to thet mousemove event to be executed.

Example

Before
<p onmousemove="alert('Hello');">Hello</p>
Code
$("p").mousemove();
Result
alert('Hello');

onemousemove(Function fn) : jQuery

fnFunctionA function to bind to the mousemove event on each of the matched elements.

Bind a function to the mousemove event of each matched element, which will only be executed once. Unlike a call to the normal .mousemove() method, calling .onemousemove() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onmousemove="alert('Hello');">Hello</p>
Code
$("p").onemousemove( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first mousemove

unmousemove(Function fn) : jQuery

fnFunctionA function to unbind from the mousemove event on each of the matched elements.

Removes a bound mousemove event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onmousemove="myFunction">Hello</p>
Code
$("p").unmousemove( myFunction );
Result
<p>Hello</p>

unmousemove() : jQuery

Removes all bound mousemove events from each of the matched elements.

Example

Before
<p onmousemove="alert('Hello');">Hello</p>
Code
$("p").unmousemove();
Result
<p>Hello</p>

mousedown(Function fn) : jQuery

fnFunctionA function to bind to the mousedown event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").mousedown( function() { alert("Hello"); } );
Result
<p onmousedown="alert('Hello');">Hello</p>

mousedown() : jQuery

Trigger the mousedown event of each matched element. This causes all of the functions that have been bound to thet mousedown event to be executed.

Example

Before
<p onmousedown="alert('Hello');">Hello</p>
Code
$("p").mousedown();
Result
alert('Hello');

onemousedown(Function fn) : jQuery

fnFunctionA function to bind to the mousedown event on each of the matched elements.

Bind a function to the mousedown event of each matched element, which will only be executed once. Unlike a call to the normal .mousedown() method, calling .onemousedown() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onmousedown="alert('Hello');">Hello</p>
Code
$("p").onemousedown( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first mousedown

unmousedown(Function fn) : jQuery

fnFunctionA function to unbind from the mousedown event on each of the matched elements.

Removes a bound mousedown event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onmousedown="myFunction">Hello</p>
Code
$("p").unmousedown( myFunction );
Result
<p>Hello</p>

unmousedown() : jQuery

Removes all bound mousedown events from each of the matched elements.

Example

Before
<p onmousedown="alert('Hello');">Hello</p>
Code
$("p").unmousedown();
Result
<p>Hello</p>

mouseover(Function fn) : jQuery

fnFunctionA function to bind to the mousedown event on each of the matched elements.

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

Example

Before
<p>Hello</p>
Code
$("p").mouseover( function() { alert("Hello"); } );
Result
<p onmouseover="alert('Hello');">Hello</p>

mouseover() : jQuery

Trigger the mouseover event of each matched element. This causes all of the functions that have been bound to thet mousedown event to be executed.

Example

Before
<p onmouseover="alert('Hello');">Hello</p>
Code
$("p").mouseover();
Result
alert('Hello');

onemouseover(Function fn) : jQuery

fnFunctionA function to bind to the mouseover event on each of the matched elements.

Bind a function to the mouseover event of each matched element, which will only be executed once. Unlike a call to the normal .mouseover() method, calling .onemouseover() causes the bound function to be only executed the first time it is triggered, and never again (unless it is re-bound).

Example

Before
<p onmouseover="alert('Hello');">Hello</p>
Code
$("p").onemouseover( function() { alert("Hello"); } );
Result
alert('Hello'); // Only executed for the first mouseover

unmouseover(Function fn) : jQuery

fnFunctionA function to unbind from the mouseover event on each of the matched elements.

Removes a bound mouseover event from each of the matched elements. You must pass the identical function that was used in the original bind method.

Example

Before
<p onmouseover="myFunction">Hello</p>
Code
$("p").unmouseover( myFunction );
Result
<p>Hello</p>

unmouseover() : jQuery

Removes all bound mouseover events from each of the matched elements.

Example

Before
<p onmouseover="alert('Hello');">Hello</p>
Code
$("p").unmouseover();
Result
<p>Hello</p>