jQuery: Adding class to the li element after the link is clicked, and deselecting all other classes
- by Oleg Tarasenko
Hi,
I am generating menu with such tags:
<div class="animatedtabs">
<ul>
{% for item in menu_items %}
<li><a href="{{ item.url }}" title="{{ item.name }}"><span>{{ item.name }}</span></a></li>
{% endfor %}
</ul>
</div>
What I want to do, I want to add class="selected" to li, after the link is clicked, and to remove all other class="selected" on other li's...
Also I wonder, how to show menu in the way, so the first item is selected by default... But then when another linked is clicked, then class="selected" is toggled