The HTML DOM onmouseout event occurs when the mouse pointer is moved out of an element or its children.
Syntax:
- In HTML:
<element onmouseout="myScript">
- In JavaScript:
object.onmouseout = function(){myScript}; - In JavaScript, using the addEventListener() method:
object.addEventListener("mouseout", myScript);
Example: Using the addEventListener() method
<!DOCTYPE html> <html> <head> <title>DOM onmouseout Event</title> </head> <body> <center> <h1 id="hID"> GeeksforGeeks </h1> <h2>DOM onmouseout Event</h2> <script> document.getElementById( "hID").addEventListener( "mouseover", over); document.getElementById( "hID").addEventListener( "mouseout", out); function over() { document.getElementById( "hID").style.color = "green"; } function out() { document.getElementById( "hID").style.color = "black"; } </script> </center> </body> </html> |
chevron_right
filter_none
Output:

Supported Browsers: The browsers supported by HTML DOM onmouseout event are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Recommended Posts:
- HTML | onmouseout Event Attribute
- HTML | DOM fullscreenerror Event
- HTML | DOM onvolumechange Event
- HTML | DOM onopen Event
- HTML | DOM ondragleave Event
- HTML | DOM onpaste Event
- HTML | DOM touchcancel Event
- HTML | DOM touchmove Event
- HTML | DOM Storage Event
- HTML | DOM createEvent() Event Method
- HTML | DOM touchend Event
- HTML | DOM timeStamp Event Property
- HTML | DOM stopPropagation() Event Method
- HTML | DOM cancelable Event Property
- HTML | DOM type Event Property
- HTML | DOM touchstart Event
- HTML | DOM onpause Event
- HTML | DOM onabort Event
- HTML | DOM onsuspend Event
- HTML | DOM oninvalid Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


