target .each from dynamic dom
<p>I have some dynamic DOM elements i would like to target using <code>.each</code> <br/>
when i the elements are loaded with a delay, <code>.each</code> does'nt seem to pick this up. <br/>
How can i make this work?</p>

<pre><code>setTimeout(function(){ 
    $('body').append('&lt;div id="nav"&gt;'+
        '&lt;ul&gt;'+
            '&lt;li&gt;&lt;a&gt;button 1&lt;/a&gt;&lt;/li&gt;'+
            '&lt;li&gt;&lt;a&gt;button 2&lt;/a&gt;&lt;/li&gt;'+
            '&lt;li&gt;&lt;a&gt;button 3&lt;/a&gt;&lt;/li&gt;'+
        '&lt;/ul&gt;'+
    '&lt;/div&gt;');
}, 1000);

$("#nav ul li").each(function (index) {
    $(this).delegate('a', 'click', function(){
        alert(index); //NOTHING HAPPENS
        return false;
    });
});
</code></pre>

<p>thank you Sushanth
heres my fiddle: <a href="http://jsfiddle.net/nalagg/rN9tJ/1/" rel="nofollow">http://jsfiddle.net/nalagg/rN9tJ/1/</a></p>
