Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

146
Vistas
How do I specify a class in jQuery?

I am trying to change an element from external file (fileA) in fileB. How do I change the background of the specific class (“card-body” whose child class has “input_container”, or text of “…”) WITHOUT adding another id to specify, since “card-body” is used in other parts of the file? (The reason why I cannot add an id to specify is that the fileA is inside fixtures file)

Thank you so much in advance!

fileA:

<div class="card-body py-3">
      <div class="input_container” data-label="incentive">…</div>
      <div id="incen_text" class="py-3 input_container”>;;;</div>  
</div>

FileB:

 <label for="Color">Choose your color</label>
 <input type="color" id="Color" value="#ff0000">….
 <script>
$(function(){
$("#Color").on("change", function(){
  $(‘.card-body’).each(function(){
      if($(this).children().hasClass(‘.input_container’)) {
        $(this).css(“background-color”, $(‘#Color’).val())
      };
   });
  });
});

I also tried this:

<script>
    $(function(){
    $("#Color").on("change", function(){
    $(‘.card-body’).each(function(){
       x=$(".input_container").text();
      if(x == “…”){
                 $(this).css(“background-color”, $(‘#Color’).val())
         }
      });
  });
  });

</script>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda