jQuery Set Child CSS Attribute Problem
- by Jascha
I have a child element of a div named "bob" that's class is '.divTitle'
<div id="bob">
<div class="divTitle">
<a href="#">
<h1>Title</h1>
</a>
</div>
</div>
I am trying to set the background color of "divTitle" to red but for the life of me can't get this to work. Right now I am trying two things...
$('#bob').children('.divTitle')[0].css('background-color', '#0f0'); // assuming children is returning an array...
and
$('#bob').children('.divTitle').css('background-color', '#0f0');
neither with any success... can anyone tell me what I am missing here? Do I have to go deeper than ".children"?