Call a function when moving the mouse pointer out of an image:
More examples below.
Definition and Usage
onmouseleave event occurs when the mouse pointer leaves an element.
onmouseleave event is often used together with the
onmouseenter event, which occurs when the
mouse pointer enters an element.
onmouseleave event is similar to the
event. The difference is that the
onmouseleave event does not bubble
(does not propagate up the document hierarchy). See "More Examples" at the
bottom of this page to better understand the differences.
|onclick||The user clicks on an element|
|oncontextmenu||The user right-clicks on an element|
|ondblclick||The user double-clicks on an element|
|onmousedown||A mouse button is pressed over an element|
|onmouseenter||The pointer is moved onto an element|
|onmouseleave||The pointer is moved out of an element|
|onmousemove||The pointer is moving over an element|
|onmouseout||The mouse pointer moves out of an element|
|onmouseover||The mouse pointer is moved over an element|
|onmouseup||The mouse button is released over an element|
|HTML tags:||All HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>|
|DOM Version:||Level 2 Events|
This example demonstrates the difference between the onmousemove, onmouseleave and onmouseout events:
<p id="demo1">I will demonstrate onmousemove!</p>
<p id="demo2">I will demonstrate onmouseleave!</p>
<p id="demo3">I will demonstrate onmouseout!</p>
onmouseleave is a DOM Level 2 (2001) feature.
It is fully supported in all browsers: