The mouseleave function is executed when the mouse pointer leaves the HTML element:
<!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> </head> <body> <div>Click me to hide</div> <script> $("div").on("mouseleave", function() { alert("Bye"); }); </script> </body> </html>