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

186
Views
Detectar clic fuera de un <td> usando jQuery

Tengo un td como a continuación.

 <td class="volunteer" id="422" data-select2-id="select2-data-422"> <select multiple="" data-select2-id="select2-data-1-dpng" tabindex="-1" class="select2-hidden-accessible" aria-hidden="true"> //more code here </select> <span class="select2 select2-container select2-container--default select2-container--below select2-container--focus" dir="ltr" data-select2-id="select2-data-2-ooba" style="width: 16px;"> //more code here </span> </td>

Me gustaría detectar clics fuera de este td . Utilicé el siguiente código jQuery.

 $(document).click(function (e) { alert('hello'); $('.volunteer *').unbind('click'); });

Pero no está funcionando.

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

0

En primer lugar, agregaría el oyente a document.body y luego verificaría si el objetivo del evento está o está contenido en un volunteer

 $(document.body).click(function (e) { alert('hello'); if (!e.target.closest('.volunteer')) { $('td.volunteer *').unbind('click'); } });
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!