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

188
Views
JavaScript: Chrome y Safari no desencadenan eventos de mouse cuando se hace clic en <opción> de <seleccionar> ya seleccionada

Estoy tratando de responder cuando el usuario vuelve a hacer clic en la <option> actualmente seleccionada en un <select> . El FF de escritorio actual (v95.0.2) mousedown , mouseup y hace click en el elemento <option> en sí mismo, y todo se captura hacia abajo y burbujea hacia arriba a través de toda la jerarquía de HTMLDocument , incluida la window contenedora.

En la misma situación, el Chrome de escritorio actual (96.0.4664.110) y Safari (14.1.2) no parecen activar ningún evento en absoluto.

 <html lang="en" id="thehtml"> <head> </head> <body id="thebody"> <select id="theselect"> <option id="option1" value="1">one</option> <option id="option2" value="2">two</option> </select> </body> <script> function logEvent(ev) { console.log( ev.type + ' target: ' + (ev.target.localName ? `${ev.target.localName} #${ev.target.id}` : `(${ev.target.constructor.name})`) + ' this: ' + (this.localName ? `${this.localName} #${this.id}` : `(${this.constructor.name})`) ); } var eventList = ['change', 'click', 'dblclick', 'input', 'mousedown', 'mouseup']; var elementList = ['thehtml', 'thebody', 'theselect', 'option1', 'option2']; for (let ev of eventList) { window.addEventListener(ev, logEvent, true); // capture window.addEventListener(ev, logEvent, false); // bubble document.addEventListener(ev, logEvent, true); // capture document.addEventListener(ev, logEvent, false); // bubble for (let id of elementList) { document.getElementById(id).addEventListener(ev, logEvent, true); // capture document.getElementById(id).addEventListener(ev, logEvent, false); // bubble } } </script> </html>

¿Hay alguna forma en Chrome o Safari de detectar al usuario haciendo clic con el mouse en la <option> seleccionada actualmente?

about 4 years ago · Juan Pablo Isaza
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!