I am facing a strange issue while using javascript setTimeout function in IE8. I want to use the \'setTimeout\' function like this -
setTimeout(timeout,2000
If you want to call timeout with changing variable (e.g. calling timeout in loop with lot of names) you can use also in IE8:
var names = ["saarthak", "saarthak2", "saarthak3"];
for (var q in names) {
setTimeout(
(function(opts){
return function(){
alert ("hello " + opts.name)
}
})({name:names[q]}), 2000);
}
see: http://jsfiddle.net/q4HYz/