Javascript examples for jQuery Method and Property:hover
Use hover function to change paragraph background color
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").hover(function(){ $(this).css("background-color", "yellow"); }, function(){/*from ww w. ja va 2s .c om*/ $(this).css("background-color", "pink"); }); }); </script> </head> <body> <p>Hover the mouse pointer over this paragraph.</p> </body> </html>