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

166
Views
Función jQuery con JS puro

Hay enlace de clic de función en el selector

 $(document).on("click", ".onClass", function () { //your code var element = $(this); // to get clicked element });

¿Hay algún análogo con js puro?

PD He visto esta solución ¿Cómo hacer clic en el elemento (para todo el documento)? pero no es una solución que estoy esperando.

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

0

Puede vincular el detector de eventos al documento de la misma manera, pero debe probar el elemento de destino para ver si este o uno de sus ancestros coincide con el selector.

 document.addEventListener('click', (event) => { const selector = ".onClass"; const element = event.target; if (!element.closest(selector)) return; // No match so abort here // Otherwise: Do stuff with element });
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!