jquery public function

Solutions on MaxInterview for jquery public function by the best coders in the world

showing results for - "jquery public function"
Curtis
31 Jan 2021
1(function($){
2
3$.fn.myPlugin = function(options) {
4    // support multiple elements
5    if (this.length > 1){
6        this.each(function() { $(this).myPlugin(options) });
7        return this;
8    }
9
10    // private variables
11    var pOne = '';
12    var pTwo = '';
13    // ...
14
15    // private methods
16    var foo = function() {
17        // do something ...
18    }
19    // ...
20
21    // public methods        
22    this.initialize = function() {
23        // do something ...
24        return this;
25    };
26
27    this.bar = function() {
28        // do something ...
29    };
30    return this.initialize();
31}
32})(jQuery);
33