javascript - How to pass arguments to a function in setTimeout -
i have following code:
function fn($){ return function(){ innerfn = function(){ settimeout(show, 1000); }; show = function(){ $.alert("test"); } } }
but, after 1 second, when function show
run, says $ undefined. how resolve issue?
how pass arguments function in settimeout
settimeout has built in mechanism adding params
var timeoutid = window.settimeout(func, delay, [param1, param2, ...]);
use it.
if you're going use this
- should careful. that's question.
Comments
Post a Comment