i simplified my issue as the following: I have a huge array of elements and, for each of them, i need to create a div. This causes a browser freeze or even worse a popup asking to stop the script.
var fruits = ["0"]; 
for ( var i = 1; i < 2000; i ++){
    fruits.push(i);
}
function qweqwe(fruits) {
    var ida = fruits.shift();
    if (ida) {
        console.log(ida);
        $('#0').clone(true).attr('id', ida).insertAfter($('.asd:last'));
        qweqwe(fruits);
    }
}
$( "#butt" ).click(function() {
qweqwe(fruits);
});
Is there any way to avoid it? or any workaround? any way to create 50 elements at a time maybe? i created a jsfiddle to better explain my issue http://jsfiddle.net/b7dewtsk/1/ thanks in advance regards
 
     
    