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, {name:'saarthak'});
function timeout(opts)
{
alert('hello ' + opts.name);
}
the third parameter of the setTimeout is the argument that I want to pass to the calling function. This is working perfect fine in FF, Chrome but not in IE8.
Does anybody have any clue what could be done? Or any work around of achieving this?
Thanks
Probably not supported there, so have this instead:
Meaning call your function from within anonymous function.