mwjackson mwjackson -4 years ago 114
jQuery Question

How do I skip the first iteration of an $.each()?

I have a JSON list that I want to iterate over, but skip the first entry, like thus:

$.each(
data.collection,
function() { DoStuffButOnlyIfNotTheFirstOne(); }
);


Any ideas?

Answer Source

Is this good enough?

$.each(
    data.collection,
    function(i) {
        if (i > 0)
            DoStuff();
    }
);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download