Reputation: 5428
Can anyone tell me how I would make the Div that contains "G" below have a Green background color using JQuery. I have used Drupal to provide a class name of bsc-data and an id of t-impact to the parent div.
There will be other div's on the page that also have the class of pane-content but their parent div will have a different id.
<div class="panel-pane pane-token pane-node-field-impact-to-customer bsc-data" id="t-impact">
<h2 class="pane-title"> </h2>
<div class="pane-content">G</div>
</div>
Upvotes: 0
Views: 87
Reputation: 1885
$("#t-impact > div.pane-content").css("background-color", "green");
You can see about the css selector. ">" means directly under the parent. So it can select the div.pane-content directly under the #t-impact even if you have another div.pane-content as a child of div.pane-content.
Upvotes: 0
Reputation: 1430
$('#t-impact div').css('background-color',"green")
will do the magic....
Upvotes: 1
Reputation: 864
you can use jQuery("#t-impact div).css({background-color:"#00ff00"});
This will apply green back ground to the child div
Upvotes: 0