Basically I have a function that passes this… I need this function to be executed 1/3 seconds after a button got clicked so what I thought of doing is:
setTimeout("somefunction(this)", 3000);
As I know that setTimeout(“”, x); works with “”
but it doesn’t work.
I’ve tried without the “” and it wont work either I tried to:
setTimeout("somefunction("+this+")", 3000);
and still won’t work. Did like an hour of attempts at this.
Any help would be highly appreciated.
You need to use a closure