Attach a function to the mousemove event: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:mousemove

Description

Attach a function to the mousemove event:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials