hi,
i'm trying to add a background color to a element which is positioned before the identified tag. for example, i know the class of one elment and i have a list like below.
<ul id="one">
<li><a href='#'>text0</a></li>
<li><a href='#'>text1</a>
<ul>
<li><a href='#'>text2</a></li>
<li><a href='#'>text3</a>
<ul>
<li class="item-1"><a href='#' class='identified'>item1</a></li>
<li class="item-2"><a href='#'>item2</a></li>
<li class="item-3"><a href='#'>item3</a></li>
</ul>
</li>
<li class="item-c">C</li>
</ul>
</li>
<li class="item-iii">III</li>
</ul>
now i want to assign a background color to the 1st level element if i know class='identified' i want to cange the background color of <a href='#'>text1</a>
i used this code which is obviously wrong, since there is repeating <a> tags.
what can i do to make this work.?
$('ul li a.identified').closest('a')
.css('background-color', 'red');