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

132
Views
Agregar .not() en el manejo de eventos al contenido agregado dinámicamente

Con el manejo de eventos en contenido agregado dinámicamente, uso:

 $('#static-div').on('click', '.dynamic-content', function () { // do something });

¿Qué debo hacer si quiero agregar un .not() a este código? Como en, quiero hacer clic en cualquier cosa con ". contenido dinámico" pero no aplicar el manejo de eventos a ". no se debe hacer clic"

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

0

Agregar :not() al selector

 $('#static-div').on('click', '.dynamic-content:not(.no)', function () { console.log('clicked') });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div id="static-div"> <button type="button" class="dynamic-content">Y</button> <button type="button" class="dynamic-content no">N</button> <button type="button" class="dynamic-content">Y</button> <button type="button" class="dynamic-content no">N</button> </div>

about 4 years ago · Juan Pablo Isaza Report

0

Hay un selector no css que puede agregar a esto.

Compruébalo aquí

 $('#static-div').on('click', '.dynamic-content:not(.should-not-be-clicked) ', function () { // do something });
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!