jQuery: Do a function only once in an Ajax load
<p>I'm trying to do a simple <code>.fadeIn()</code> ONCE for the first div, but the problem is that this is an Ajax load inside a <code>everyTime(xxx sec)</code>, so it does the same thing everytime it loads again.</p>

<p>How can I prevent the first <code>div</code> to <code>.fadeIn()</code> over and over again, but still do this function on the new <code>div</code>?</p>

<p>I am not very familiar with jQuery, so feed me with a spoon :)</p>

<h3>Update:</h3>

<p>I have been trying out all of your suggestions! I really appreciate your help, but I'm still stuck. I haven't got the <code>.one</code> to work. I tried <code>$("#chatline:first").one(function(){ $(this).fadein()});</code>, but I get a major failure from jQuery :p as I said. I'm pretty new to jQuery.</p>

<p>I also tried adding and removing classes, but cannot make jQuery remember that the class is removed, so it fades in and out, etc.</p>

<p>Here's the script, sligtly shorted.</p>

<p>...</p>

<pre><code>j(document).ready(function(){

   //reloads every 3sec

j(".chatref").everyTime(3000,function(i){
j.ajax({url: "chatx.php",
cache: false,
success: function(html){
j(".chatref").html(html);

   // These for testing

if($('div#chatline').hasClass('first')){
j("#chatline").fadeIn('slow');
}
</code></pre>

<p>snipped... End of jQuery</p>

<p>PHP (part of chatx.php):</p>

<pre><code>div class='chatref' &lt;- This one is only for jQuery's everytime function, e.g where to show the stuff. Don't know other ways to do this.

//First div I added classname first and hidden with PHP.

div class='chatline hidden first'

div class='chatline'

div class='chatline'
div class='chatline'

.... etc.
</code></pre>

<p>snipped... End PHP.</p>

<p>I hope I have explained it good enough! Thanx for the help guys!!</p>
