Re: [jQuery] setTimeout with variables (in a jQuery statement)

2009-11-04 Thread Michel Belleville
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 ? -

[jQuery] setTimeout with variables (in a jQuery statement)

2009-11-04 Thread north
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