I need to remove the selected class of an <a> and assign it the last <a> instead. Both are nested within individual <li> elements.
Here's an example of the code:
<ul class="tabs clearfix">
<li class="tab"><a href="#one" class="selected">Home</a></li>
<li class="tab"><a href="#two">About</a></li>
<li class="tab"><a href="#three">Profile</a></li>
<li class="tab"><a href="#four">History</a></li>
<li class="tab"><a href="#five">The Beginning of V-Cube</a></li>
</ul>
How can I achieve this using JavaScript/jQuery? Please advise.
EDIT:
Let's say I don't want to target the last tab specifically. Can the href be used as a selector instead?
EDIT #2:
Thank you so much everyone for the quick response. All your answers were spot on, wish I could mark them all as answers :)
a[href="VALUEOFYOURHREF"]