Javascript examples for jQuery Method and Property:mousemove
Attach a function to the mousemove event:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(document).mousemove(function(event){ $("span").text(event.pageX + ", " + event.pageY); });//from ww w.ja va 2s .co m }); </script> </head> <body> <p>Mouse is at coordinates: <span></span>.</p> </body> </html>