Length returns the value of the total siblings and won't update if a sibling is removed. Why?
<p>When a page loads for the first time, the .length on siblings returns let's say 3. Then a "click" event triggers a post and on success removes a sibling and the .length is called again, but it keep returning 3.</p>

<p>Please note that each sibling is remove via a "click" event at random time and not within the same loop.</p>

<p>Example: (hand-coded here, but should explain the behavior)</p>

<pre><code>&lt;ul id="un33k"&gt;
    &lt;li&gt;&lt;a class="clicked" href="/link/1"&gt;Link 1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a class="clicked" href="/link/2"&gt;Link 2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a class="clicked" href="/link/3"&gt;Link 3&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a class="clicked" href="/link/4"&gt;Link 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

$(document).ready(function(){
    var total_li = $('#un33k').children().length; // 3 (test only)

    $('a.clicked').click(function () {
        var me = this;
        $.post('somelink', {...}, function(data, status) { // assuming success
            var new_total_li =  $(me).closest('li').siblings().length; // 3, good
            var parent = $(me).closest('li').parent() // can't hardcode id
            $(me).closest('li').remove(); // assuming the clicked li is gone now
            new_total_li =  $(parent).children().length; // 3, but should be 2 now?
        }, "json");
    });
});
</code></pre>

<p>Even a click few minutes later, would still show 3. Why?</p>

<p><strong>Update: Copying the actual code here:</strong></p>

<p>This line is the culprit (<em>console.log($(me).closest('li').siblings().length</em>) which shows the same initial number no matter how many siblings are deleted.</p>

<pre><code>&lt;script&gt;
$(document).ready(function(){
    $('a.get2post').click(function () {
        var me = this;
        var url = $(me).attr('href');
        if ($(me).hasClass('confirm')){
            if(!window.confirm("Are you sure?")){
                return false;
            }
        }
        if ($(me).hasClass('deletion')){
            var postdata = {ajax: 'true' };
            $.post(url, postdata, function(data, status) {
                if (status == 'success'){
                    $(me).closest('li').hide('slow', function(){ $(me).remove(); });
                    console.log($(me).closest('li').siblings().length) // problem
                }
            }, "json");
       }
       return false;
    });
});
&lt;/script&gt;
</code></pre>
