Get last ID of dynamic div
<p>Couldn't find an answer, but Im trying to get the last ID of the last div that was created on the page. The code I'm using doesn't seem to work using .last(). My syntax is probably wrong but I can't get it to show the ID.</p>

<pre><code>  jQuery(document).ready(function()
    {jQuery("a.more_posts").live('click', function(event){
            jQuery("div[id^='statuscontainer_']").last();
            var id = parseInt(this.id.replace("statuscontainer_", ""));
            alert(id);
       }); 
    });
</code></pre>

<p>I figured out to do it this way and this worked.</p>

<pre><code>jQuery(document).ready(function(){  
jQuery("a.more_posts").live('click', function(event){
        jQuery("div[id^='statuscontainer_']:last").each(function(){
        var id = parseInt(this.id.replace("statuscontainer_", ""));
        alert(id);
    }); 
}); 
}); 
</code></pre>
