jQuery addClass() not working given an ID
<p>I have the following jQuery code:</p>

<pre><code>$.ajax({
  type: "POST",
  url: "/search",
  data: $("form").serialize(),
  success: function(data) {
    $("#tab").addClass("loading"); // THIS LINE DOESN'T WORK
    // . . . LOAD SEARCH RESULTS HERE (USUALLY TAKES SEVERAL SECONDS) . . .
    $("#tab").removeClass("loading");
  }
});
</code></pre>

<p>And I have the following CSS:</p>

<pre><code>.loading {
  background: transparent url(../resources/images/loading.gif) no-repeat right center;
  text-indent: -1000px;
}
</code></pre>

<p>And I have the following relevant HTML:</p>

<pre><code>&lt;div id="tab"&gt;
  &lt;table id="searchResultsGrid"&gt;&lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>I can't get the line <code>$("#tab").addClass("loading")</code> to work. Watching in FireBug, the class <code>.loading</code> is never added to the <code>#tab</code> object.  What am I doing incorrectly?</p>

<p>Thanks!</p>
