Soldato
- Joined
- 12 May 2007
- Posts
- 3,896
- Location
- Bristol
I'm not that great with jquery yet but I need the following quickly and someone will probably be able to give me the answer before I can get it working by myself.
I just need to use jquery to search for any 'li a' element which has class 'selected'. Then, it needs to target the 'li' element before it and add a class to it.
Any help would be appreciated.
I just need to use jquery to search for any 'li a' element which has class 'selected'. Then, it needs to target the 'li' element before it and add a class to it.
Code:
Before...
<ul>
<li><a href="#">Link</a></li>
<li><a href="#" class="selected">Link</a></li>
</ul>
After..
<ul>
<li class="besideSelected"><a href="#">Link</a></li>
<li><a href="#" class="selected">Link</a></li>
</ul>
Any help would be appreciated.