Dynamic text in divs - how to get both to work on same page?
<p>I have two DIV tags (and maybe more) with dynamic text.  I need them to cycle in a loop.  I got it working with one DIV tag.  but when I apply the same script to a second DIV tag, only one works.</p>

<p>How do I get both to work at the same time on the same page?</p>

<pre><code> &lt;script type="text/javascript"&gt;
 var text = ['foo', 'bar', 'baz'];
 i = 0,
 $div = $('#DIV1');

 setInterval(function ()
 {
 $div.fadeOut(function ()
 {
    $div.text(text[i++ % text.length]).fadeIn();
});
}, 1000);
&lt;/script&gt;

 &lt;script type="text/javascript"&gt;
 var text = ['foo', 'bar', 'baz'];
 i = 0,
 $div = $('#DIV2');

 setInterval(function ()
 {
 $div.fadeOut(function ()
 {
    $div.text(text[i++ % text.length]).fadeIn();
});
}, 1000);
&lt;/script&gt;
</code></pre>
