Here is the code.
(function($){ $.fn.testfunc = function() { this.init = function() { setInterval(this.func1(), 1000); }; this.func1 = function() { console.log('func1'); this.func2(); }; this.func2 = function() { console.log('func2'); //some codes }; return this.init(); } })(jQuery);
*When I use parenthesis the 1st and 2nd method runs but the 1st method is called only once.
*When I don't use parenthesis the 1st method runs in interval just fine but it doesn't/couldn't call the 2nd method.
What should I go with? With parenthesis or not? I need to run the 1st method in the interval but also need to call 2nd method.