How to Jquery each complete

Baha Adıyaman picture Baha Adıyaman · Nov 20, 2014 · Viewed 34.1k times · Source

I did not do the complete in $.each(). How this is done? Please help me.

$("element").each(function (i, v) {
        //No problem
    }, function () {
        //How to complete finished ??
        // alert(each finish);
    })

Answer

Brewal picture Brewal · Nov 20, 2014

To execute code after the each loop is over :

var count = $("element").length;

$("element").each(function (i) {
    // loop
    if (i+1 === count) {
        // this will be executed at the end of the loop
    }
});