Javascript examples for jQuery Method and Property:on
Compare mouse click, mouse over and mouse out events
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").on({//w w w . ja v a 2 s.c o m mouseover: function(){ $("body").css("background-color", "gray"); }, mouseout: function(){ $("body").css("background-color", "blue"); }, click: function(){ $("body").css("background-color", "yellow"); } }); }); </script> </head> <body> <p>Click or move the mouse pointer over this paragraph.</p> </body> </html>