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

742
Views
Is there any method to replace initEvent in typescript?

I would like to trigger the MouseEvent manually in typescript and it shows the initEvent is deprecated.

var clickEvent =document.createEvent('MouseEvent');
clickEvent.initEvent('mouseup',true,true);

in this screenshot, it shows the initEvent is deprecated.

Is there any alternate way to achieve this?

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

0

initEvent is now depreciated as shown in the hint. A note in the docs says:

Note: Do not use this method anymore as it is deprecated. Instead use specific event constructors, like Event().

MouseEvent is an interface and it is used by different types of events. One of them being mouseup. The new way of doing this is :

const mouseupEvent = new MouseEvent("mouseup",{bubbles : true, cancelable: true});

// Dispatch the event.
document.dispatchEvent(clickEvent);
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!