How can I get a user to click on a tag that is inside an li element (div ul li a)? By default, the first a tag has a class of 'on'. When the tag is clicked, the code should add the class 'on' to the clicked element and remove it from all other siblings. However, the removal of the class from siblings is not working as expected.
var menu01_list = $(".profile_menu01 ul li > a");
menu01_list.click(function(){
$(this).siblings().removeClass('on');
$(this).addClass('on');
});
Here is the HTML code:
<div class="profile_menu01">
<ul>
<li><a class="btn_my_pick on" href="#">My Pick</a></li>
<li><a class="btn_my_pickpot" href="#">3<span class="alert_num"></span>My Picpot</a></li>
<li><a class="btn_my_review" href="#">My ReView</a></li>
<li><a class="btn_my_photos" href="#">My Photos</a></li>
</ul>
</div>