What is onmouseleave event in JavaScript?


The onmouseenter event triggers when after the mouse hover is moved out.

Example

You can try to run the following code to learn how to work with an onmouseleave event in JavaScript −

<html>
   <head>
      <script>
         <!--
            function sayHello() {
               alert("Mouse Leave")
            }
         //-->
      </script>
   </head>
   <body>
      <p onmouseleave = "sayHello()">This is demo text for mouseleave event.</p>
   </body>
</html>

Updated on: 19-Jun-2020

177 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements