I'd use an anonymous function and pass it to setTimeout like this :
var selector = '#whatever .selector';
var savVal = 'whatever value';
setTimeout(function() {
$(selector).val(savVal);
}, 1000);
Notes for the careful reader :
- There no "this" in the anonymous function, why is that ?
-
Hi,
I'm trying to use a jQuery statement inside a setTimeout function, but
I don't get it to work. I tried a lot of variants, like this one (I'm
using 'this' because the setTimeout is inside an each function, and
the selector is cached/stored in an object, thus the $selector):
setTimeout("" + thi
2 matches
Mail list logo