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

154
Views
¿Cómo hacer que un mouse haga doble clic en un solo clic en javascript simple?

Hola, estoy escribiendo un complemento sin JQuery.

Con un solo clic, item.id no está definido y el enlace no se abre. Pero después de un segundo clic, se define la identificación.

Así que estoy buscando una solución para hacer que el mouse haga doble clic en un solo clic al hacer clic en este enlace href.

El div no tiene una identificación predeterminada propia.

Gracias por tu ayuda

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

0

Este código desencadena un doble clic para cada etiqueta que tiene a clase de anchorLink cuando hace clic en ellos.

Lo he explicado fila por fila en el código con comentarios sobre cómo funciona

 // Creating an event for double click (dblclick) var event = new MouseEvent('dblclick', { 'view': window, 'bubbles': true, 'cancelable': true }); // get every a tag with class anchorLink and loop through them document.querySelectorAll("a.anchorLink").forEach(anchorLink => { // add click event to it anchorLink.addEventListener('click', function (e) { // trigger double click event we created at top anchorLink.dispatchEvent(event); }); // This is just to show that it triggers double click by single clicking // You dont need from here anchorLink.addEventListener('dblclick', function (e) { console.log(e.target.innerText); }); //to here // });
 <a class="anchorLink" href="#" title="db2un_Fri Oct 18 16_38_15 2019.log" data-dojo-attach-point="linkColumnAnchor">db2un_Fri Oct 18 16_38_15 2019.log</a> <br> <a class="anchorLink" href="#" title="db2un_Fri Oct 18 16_38_15 2020.log" data-dojo-attach-point="linkColumnAnchor">db2un_Fri Oct 18 16_38_15 2020.log</a>

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!