 <p>You can do the following:</p> <pre><code>$(selector).on('click', function(e){ e.preventDefault(); $(this).parent().addClass('active').siblings('.active,.current') .removeClass('active current'); }); </code></pre> <p>First you go to the upper level (<code>LI</code>) and add <code>active</code> class to it. Then, selecting its siblings with classes <code>active</code> and <code>current</code>, and remove those classes from the matched elements.</p> <p>Note that I also added <code>e.preventDefault()</code> to prevent and redirect action when you click on the <code>A</code> element.</p>