Quote:
Originally Posted by schotte
Hey all,
as I mentioned in the title, I've an issue getting setTimeout to work inside a plugin I am developing.
Code:
$.Plugin = function(obj,opt)
{
init();
function init() { ... };
function heartbeat() { ... };
setTimeout('heartbeat();', 1000);
}
Error: heartbeat is not defined
Anyone dealt with this before?
Cheers
|
try this
Code:
$.Plugin = function(obj,opt)
{
init();
function init() { ... };
function heartbeat() { ... };
setTimeout(heartbeat, 1000);
}
no braces no parentheses just pass the function object itself instead of a string.