jQuery mouseleave()
work with mouseenter()
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>/* w w w . ja v a2 s . c o m*/ <script> $(document).ready(function(){ $("p").mouseenter(function(){ $("p").css("background-color", "yellow"); }); $("p").mouseleave(function(){ $("p").css("background-color", "lightgray"); }); }); </script> </head> <body> <p>Move the mouse pointer over this paragraph.</p> </body> </html>