I have read the post here about using setTimeout() during intensive DOM processing (using JavaScript), but how can I integrate this function with the below code? The below c
If you need something simpler, I wrote a jQuery plugin to ease writing of asynchronous loops: jQuery Async.
Using the plugin, your code can be rewritten as:
function appendToSelect() {
$("#mySelect").children().remove() ;
$("#mySelect").html(
''
);
/////////////////////////////
var i = 1;
$.whileAsync({
test: function(){ i < obj.data.length; }
loop: function()
{
$("#mySelect").append(
''
);
i++;
}
});
/////////////////////////////
}
Should help the responsiveness. Tweak the 'bulk' and 'delay' option for more control.