Extend picEdit jquery plugin

Hi, I am trying to extend this jQuery plugin, but it looks like I cannot find a way to do this like other plugins. I tried:

$.fn.picEdit.somefunction = function() { 

But it seems that the functions of the plugin are encapsulated.

Does anyone know how to override this particular plugin (without editing / not hacking any files inside the JS plugin)? I just want to know if it can be expanded or not. Thanks.

+7
jquery jquery-plugins
source share
2 answers

You can duplicate the picEdit object, extend this object, and set jQuery.fn.picEdit to the copy.

the code:

 (function(window, document, $, undefined) { // your methods var methods = { sayHi: function(name) { alert("Hello " + name); } }; // duplicate of the extended picEdit var newPicEdit = $.extend($.fn.picEdit, methods) // set jQuery.fn.picEdit $.fn.picEdit = newPicEdit; })(this, this.document, jQuery); 

Good luck, hope this helps.

+1
source share

I believe this post can help you.

Look at the comments and there is even a worthy example of Matt Hugins on how to achieve this.

0
source share

All Articles