onmouseleave event
Example
Execute JavaScript when the mouse pointer moves out:
Try it »
In the more examples below, click "Try it" to see more demonstrations.
Definition and Usage
The onmouseleave event is triggered when the mouse moves out of the element.
Tip: This event is usually used together with onmouseenter event is used together with this event, which is triggered when the mouse moves onto the element.
Tip: The onmouseleave event is similar to onmouseout The onmouseleave event is similar to the event. The only difference is that the onmouseleave event does not support bubbling.
Browser support
The numbers in the table indicate the version number of the first browser to support the event.
| Events | |||||
|---|---|---|---|---|---|
| onmouseleave | 30.0 | 5.5 | Yes | 6.1 | 11.5 |
Syntax
In HTML:
<
element
onmouseleave="
myScript
">Try it
In JavaScript:
object
.onmouseleave=function(){
myScript
};
Try it
In JavaScript, use the addEventListener() method:
object
.addEventListener("mouseleave",
myScript
);
Try it
Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.
Technical Details
| Does it support bubbling: | No |
|---|---|
| Is it cancelable: | No |
| Event type: | MouseEvent |
| Supported HTML tags: | All HTML elements, except: , , , |
Event Object