Skip to content

Instantly share code, notes, and snippets.

@VitaliyR
Created June 22, 2015 08:50
Show Gist options
  • Save VitaliyR/0df0f9b691c6a6b6aa26 to your computer and use it in GitHub Desktop.
Save VitaliyR/0df0f9b691c6a6b6aa26 to your computer and use it in GitHub Desktop.
Extend jQuery plugin
(function($) {
/**
* Namespace: the namespace the plugin is located under
* pluginName: the name of the plugin
*/
var extensionMethods = {
/*
* retrieve the id of the element
* this is some context within the existing plugin
*/
showId: function(){
return this.element[0].id;
}
};
$.extend(true, $[ Namespace ][ pluginName ].prototype, extensionMethods);
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment