Skip to content
Related Articles

Related Articles

HTML | DOM onmousemove Event

View Discussion
Improve Article
Save Article
  • Last Updated : 04 Aug, 2021
View Discussion
Improve Article
Save Article

The DOM onmousemove event in HTML occurs when the pointer is move over an element.
Supported Tags: It supports All HTML elements, EXCEPT:

  • <base>
  • <bdo>
  • <br>
  • <head>
  • <html>
  • <iframe>
  • <meta>
  • <param>
  • <script>
  • <style>
  • <title>


  • In HTML: 
<element onmousemove="myScript">
  • In JavaScript: 
object.onmousemove = function(){myScript};
  • In JavaScript, using the addEventListener() method: 
object.addEventListener("mousemove", myScript);

Example: Using the addEventListener() method 


<!DOCTYPE html>
        HTML DOM onmousemove Event
        <h1 id="eleID">GeeksforGeeks</h1>
        <p id="demo"></p>
              "mousemove", function(event) {
            function GFGfun(event) {
                alert("A computer science portal")

Before move: 

After move: 

Supported Browsers: The browsers supported by DOM onmousemove event are listed below: 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!