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

144
Views
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
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!