(function($){
$.fn.slideshow = function(){
function init(obj){
setInterval("startShow()", 3000);
}
function startShow(){
alert('h');
}
return this.each(function(){
init(this);
});
}
})(jQuery);
i am getting error
startShow is not defined
Change
To
When you pass a string to setInterval(), the code inside is executed outside of the current scope. It’s much more appropriate to just pass the function anyway. Functions can be passed around just like any other variable if you leave the parenthesis off.
If you need to pass a variable, you can use a solution similar to the one Guffa provided:
This creates an anonymous function to be passed as the first argument to setInterval(), and within that anonymous function you have access to variables and functions further up the scope chain.