jQuery event - mouseleave() method
Example
Change the background color of the element when the mouse pointer leaves the element:
$("p").mouseleave(function(){ $("p").css("background-color","#E9E9E4"); });
Definition and usage
mouseleave event occurs when the mouse pointer leaves the element.
This event is usually used with mouseenter events together.
mouseleave() method triggers mouseleave event, or specify the function to be executed when mouseleave event occurs.
Note:Unlike mouseout event, mouseleave event is triggered only when the mouse pointer leaves the selected element. If the mouse pointer leaves any child element, mouseout event will also be triggered. See the demonstration below.
Try it yourself:mouseleave and mouseout difference
Bind function to mouseleave event
Syntax
$(selector).mouseleave(function)
Parameter | Description |
---|---|
function | Optional. Dáwọ tśa fún dàbà tśa lọwaliya láshe dàbà shígèng. |