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

163
Views
Jquery if/else elimina la clase en datos dinámicos

Hola, estoy tratando de agregar y eliminar una clase css según el valor que haya en el div

si el valor es igual a personalizado, ahora agrego una clase que elimina: después de anexar a mi texto.

Quiero volver a aplicar la clase si es lo contrario.

 setInterval(function() { $('.monthappend').each(function() { var text = $(this).text(); $(this).text(text.replace('$0', 'CUSTOM')); if ($(this).text() == 'CUSTOM') { $('.monthappend').addClass('without-after-element'); } else { $('.monthappend').removeClass('without-after-element'); } }); }, 1000);

esta declaración else no funcionó ... intenté agregar otra verificación de intervalo después de esta

 <script> setInterval(function() { $('.monthappend').each(function() { if ($(this).text() != 'CUSTOM') { $('.monthappend').removeClass('without-after-element'); } }); }, 2000); </script>

pero esto solo provocó que el texto adjunto apareciera y volviera a aparecer en un bucle.

¡Por favor ayuda!

sitio estoy trabajando este código en https://staging-homecarepulse.kinsta.cloud/pricing-calc-2/

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!