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

303
Views
¿Por qué Dropdown no funciona después de la llamada ajax?

Estoy usando el código jquery para hacer menús desplegables en los filtros de la barra lateral. este código funciona correctamente, pero después de seleccionar un filtro, este código no funciona, creo que debido a la llamada ajax. que es solucion por favor guíame

 jQuery(function(){ jQuery("#sidebar h4, #sidebar h3, body.woocommerce #sidebar>div>.inner .widget h4, body.woocommerce #sidebar>div>.inner .widget h3").on('click', function(){ jQuery(this).parent().toggleClass("dropdown-hide"); }); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

jQuery(document).on('click', "SELECTOR", function(event){ });

Esto vincula un evento de clic al documento y todos los elementos secundarios dentro de él. Este método también funcionará con elementos creados dinámicamente.

Trabajando con jQuery(document).on( eventos

 jQuery(function(){ setTimeout(function () { jQuery('.btn-group').html('<button class="btn-default">Click</button>') }, 1000); jQuery(document).on('click', ".btn-default", function(event){ console.log('clicked'); }); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="btn-group"></div>

No funciona con jQuery(selector).on( eventos

 jQuery(function(){ setTimeout(function () { jQuery('.btn-group').html('<button class="btn-default">Click</button>') }, 1000); jQuery(".btn-default").on('click', function(){ console.log('clicked'); }); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="btn-group"></div>

Entonces, tienes que cambiar como abajo

 jQuery(document).on('click', "#sidebar h4, #sidebar h3, body.woocommerce #sidebar>div>.inner .widget h4, body.woocommerce #sidebar>div>.inner .widget h3", function(event){ });
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!