onmouseleave event
Examples
JavaScript is executed when the mouse pointer moves pointers:
try it"
In the following examples more point "try" to see more demonstrations.
Definition and Usage
onmouseleave event fires when the mouse is removed elements.
Note: This event is usually associated with onmouseenter used in conjunction with the event, the event triggered when the mouse moves over the element.
Tip: onmouseleave events similar to the onmouseout event. The only difference is that events do not support onmouseleave bubbling.
Browser Support
Figures in the table represent the first browser to support this version of events.
event | |||||
---|---|---|---|---|---|
onmouseleave | 30.0 | 5.5 | Yes | 6.1 | 11.5 |
grammar
In HTML:
In JavaScript:
JavaScript, use the addEventListener () method:
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
technical details
Whether to support the bubble: | No |
---|---|
It can be canceled: | No |
Event Type: | MouseEvent |
Supported HTML tags: | All HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
More examples
Examples
This example demonstrates the difference between onmousemove, onmouseleave and onmouseout event:
<P id = "demo"> I will demonstrate onmousemove! </ P>
</ Div>
<Div onmouseleave = "myLeaveFunction ()">
<P id = "demo2"> I will demonstrate onmouseleave! </ P>
</ Div>
<Div onmouseout = "myOutFunction ()">
<P id = "demo3"> I will demonstrate onmouseout! </ P>
</ Div>
try it"