Jquery each inside of function failing
<p>I'm trying to write a function that will loop through a series of divs, single out the divs that contain a <code>small</code> element, clone the contents of the <code>small</code> element, search through another block on the page to find the <code>li</code> element whose index matches that of the current div in the loop, then insert the contents cloned from the small <code>element</code> into the <code>span</code> element within that div. </p>

<p>I've got it working up until the part where it's supposed to insert the cloned content into the <code>li</code>. Nothing happens. Also, the entire thing fails when I attempt to put it in a function as shown in the code that I've commented out. Any help would be appreciated.</p>

<pre><code>//function NewPosts(){
    jQuery('div.tracked_tags &gt; div').each(function (i) {
        var thisIndex = jQuery(this).index();
        if (jQuery(this).find('small').length){

            var postCount = jQuery(this).find('small').contents().clone();
            //alert('Hey'+postCount.html()+''+thisIndex+'');

            jQuery('div#right_column ul#tracked_tags li:eq('+thisIndex+')').find('.count').contents(postCount).alert(postCount);
            //setTimeout(arguments.callee, 30000);
        }
    });
//};
</code></pre>

<p><a href="http://jsfiddle.net/HNGJX/1/" rel="nofollow">Here's the fiddle.</a> The alerts aren't important, I just stuck them in for troubleshooting.</p>

<p>Per suggestion, this is basically the code I'm starting with:</p>

<pre><code>&lt;div class="tracked_tags"&gt;
        &lt;div&gt;
                &lt;small id="blah" class="count"&gt;10 new posts&lt;/small&gt;
                                                    &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
                &lt;small id="blah2" class="count"&gt;5 new posts&lt;/small&gt;
                                                    &lt;/a&gt;
        &lt;/div&gt;                      
&lt;/div&gt;

&lt;ul id="tracked_tags"&gt;
&lt;li&gt;&lt;a href=""&gt;&lt;span class="count"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;&lt;span class="count"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>And this is what I want to end up with:</p>

<pre><code>&lt;ul id="tracked_tags"&gt;
&lt;li&gt;&lt;a href=""&gt;&lt;span class="count"&gt;10 new posts&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=""&gt;&lt;span class="count"&gt;5 new posts&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p><strong>EDIT</strong>: I'm not sure why, but the portion of the code that copy/pastes the content from one element to the other suddenly started working. I've tweaked a few things so I'm not sure what ended up doing it, but huzzah!</p>

<p>However, the whole thing still fails is I uncomment the function wrapping it. I need it to be in a function so that it can re-run every 30 seconds.</p>
