How to remove class with this JS function
<p>This function is set up so it simply finds the -a's- within the class of menu-option-set, and says, upon click, add the class "selected" and remove the class "selected" from all others within that list.</p>

<p>What I want to do is simply have it so if you click the item that already has the class of "selected" then it removes the class of "selected".  I know it shouldn't be "return false;" I just have that as a placeholder because I can't figure out the proper coding.</p>

<p>Thanks guys! :)</p>

<pre><code>var $optionSets = $('.menu-option-set'),
    $optionLinks = $optionSets.find('a');

$optionLinks.click(function() {
    var $this = $(this);

    // Remove Class if already selected --&gt; this is the part that I need help with
    if ($this.hasClass('selected')) {
        return false;
    }

    var $optionSet = $this.parents('.menu-option-set');
    $optionSet.find('.selected').removeClass('selected');
    $this.addClass('selected');
});​
</code></pre>
