Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Move mouse with javascript

I am trying to do simple mouse move with javascript but I am unable to do it and dont know what is wrong.

function doMove(){
    let element = document.getElementById('root');

    let eventMouseDown = new MouseEvent("mousedown", {
        clientX: window.innerWidth/2,
        clientY: window.innerHeight/2
    });
    let eventMouseMove = new MouseEvent("mousemove", {
        clientX: (window.innerWidth/2)+50,
        clientY: window.innerHeight/2
    });
    let eventMouseUp = new MouseEvent("mouseup", {
        clientX: (window.innerWidth/2)+50,
        clientY: window.innerHeight/2
    });

    element.dispatchEvent(eventMouseDown);
    element.dispatchEvent(eventMouseMove);
    element.dispatchEvent(eventMouseUp);
}

First I put mouse down then move and then realease which should simulate me moving with mouse on map for example. How can I make it work?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can't move mouse using JavaScript in the website. Imagine that you are opening a website and it takes control over your mouse.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!