onmouseleave event | mouseleave event
Occurs when the user moves the mouse pointer out of the element.
The onmouseleave event is only supported by Internet Explorer, for a cross-browser solution, use the onmouseout event. The only difference between the onmouseleave and onmouseout events is that the onmouseout event propagates up the document hierarchy, while the onmouseleave does not.
Use the onmouseover event to receive a notification when the user moves the mouse pointer into and the onmousemove event to receive a notification when the user moves the mouse pointer over an element.Note: the onmouseleave event is not fired during a drag operation. For that case, use the ondragleave event.
How to register:
|object.onmouseleave = handler;|
|object.addEventListener ("mouseleave", handler, useCapture);|
|object.attachEvent ("onmouseleave", handler);|
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
Actions that invoke the onmouseleave event:
- Moving the mouse pointer out of an element.
The order of events related to the onmouseleave event:
|Internet Explorer||Firefox, Opera, Google Chrome, Safari|
Example HTML code 1:
This example illustrates the use of the Internet Explorer specific onmouseenter and onmouseleave events:
Example HTML code 2:
A cross-browser solution for the previous example:
Example HTML code 3:
This example dumps the order of events while the mouse moves into, over and out of an element:
User Contributed Comments