I have a JQuery code where i am adding class to a pre-existing divs and this is taking much time to get load. Can anyone help in this so that it takes less time to get load:

var cnt = jQuery("tbody td").length;

for(var i=0; i<cnt; i++){
    var ct=("cls"+parseInt(i+1, 10));
    jQuery("tbody td:eq("+i+")").addClass(ct);

    for(var j=0;j<=1;j++)
    {
        $ ('#tab-1, #tab-2, #tab-3').find(".cls"+i+" .tableCell-inner div").eq(j).addClass("xxx"+i+j);

    }
}

I have tried it using set timeout function as well but of no use.

0 Answers