JQuery addClass not working properly
<pre><code>$("div#pay-by-this-method ul li a").click(function(){
  $("div#pay-by-this-method ul li").removeClass("selected");
  $(this).parent("li").addClass("selected");
});

&lt;div id="pay-by-this-method" class="append-bottom"&gt;
&lt;ul id="payment-method-chooser"&gt;
    &lt;li id="" class=""&gt;&lt;a href="#" rel="" class="" &gt;Credit/Debit Card&lt;/a&gt;&lt;/li&gt;
    &lt;li id="" class=""&gt;&lt;a href="#" rel="" class=""&gt;Net 30 Account&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
 &lt;/div&gt;
</code></pre>

<p>This function applies to two links. The first link is chosen by default and has the 'selected' class already chosen. The removeClass works when I click the other link, but addClass does not fire for the other link, nor when i click the first link again (it should).</p>

<p>I don't see any reason why this function would not be working, there's not much to it. Am I missing something here?</p>

<p>BTW, there is more code (an if else statement I can't post publicly) inside the function as well that is working just fine. i can fire alerts and pretty much do anything else in this function and it works perfectly. The removeClass works fine, too, it's just the addClass that isn't firing.</p>
