jQuery function call not working
<p>I am trying to add and remove a class within a <code>&lt;span&gt;</code>, but the removeClass is not working though the function is being called.    </p>

<pre><code>setInterval(changeClass,4000);

var spanId=1;

function changeClass(){
 $('#'+spanId).addClass("hilite");
 setTimeout(remove, 1000);
 spanId++;}  

function remove(){
 $('#'+spanId).removeClass("hilite");
  return true;
  }
</code></pre>

<p>Can any one tell the reason ?</p>

<p>How can I do this with a while loop something like this i tried all my ways but chould not get it working</p>

<pre><code>var spanSet=4;
var spanId=1;
while(spanSet &gt; 0)
{
changeClass();
spanSet--;
}

function changeClass(){
$('#'+spanId).addClass("hilite");
setTimeout(remove, 3000);
}

function remove(){
$('#'+spanId).removeClass("hilite");
spanId++;
return true;
}
</code></pre>
