I was trying to add class on a current <a></a> and wanted to remove that active class from other <a></a>. i was trying
HTML
<ul> <li> <a href="#" class="active"> Home </a> </li> <li> <a href="#"> About </a> </li> <li> <a href="#"> Service </a> </li> </ul> jQuery
$('ul li a').click(function(e){ e.preventDefault(); $(this).addClass('active').siblings().removeClass('active'); });
$(this).addClass('active').parent().siblings().find('a').removeClass('active');