ExampleChange background color of an element when the mouse pointer is removed from it:
Try it yourself » |
The mouseout event occurs when the mouse pointer is removed from an element.
This event is mostly used together with the mouseover event.
The mouseout() method triggers the mouseout event, or if the function parameter is set, it specifies what happens when a mouseout event occurs.
Note: Unlike the mouseleave event, the mouseout event is triggered if a mouse pointer leaves any child elements as well as the selected element. The mouseleave event only triggers when the the mouse pointer leaves the selected element. See the example at the end of the page for a demonstration.
Trigger the mouseout event for the selected element.
|
Try it yourself » |
Specifies a function to run when the mouseout event is triggered for the selected element.
|
Try it yourself » |
Parameter | Description |
---|---|
function | Optional. Specifies the function to run when the mouseout event is triggered. |
![]() |
Try it Yourself - Examples |
The difference between mouseout and mouseleave
Demonstrates the difference between mouseout and mouseleave.