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>