Reputation: 3834
How to make a jQuery plugin which needs some methods but doesn't need a selector like the following example?
$.plugin.method(param);
Upvotes: 1
Views: 577
Reputation: 3834
Finally found the answer,
// jQuery Plugin Syntax
(function ($) {
$.plugin = {
method: function(param) {
alert(param);
};
};
}(jQuery));
Now you can call it this way:
$.plugin.method("Hello World!");
Upvotes: 3