javascript - jquery plugin method ands callbacks -
i have basic plugin populates array within plugin. how can array via method call parameters. first plugin please go easy on me if dumb question.
basic plugin
(function($) { $.fn.myplugin = function() { return this.each(function(){ tagarray = []; // array populated //code stuff populate array }); } })(jquery);
i tagarray so...
var arr = $('.classname').myplugin("getarray");
where can use array elsewhere. how can accomplish this?
thank help.
i don't see why need "getarray"
parameter. in case need define 1 array , make function return it:
(function($) { $.fn.myplugin = function() { var tagarray = []; this.each(function(){ // add tagarray }); return tagarray; } })(jquery);
Comments
Post a Comment