I was trying to figure out how to extend jquery UI plugins, and here is the solution I found (found it through jquery.ui.widget.js):
<pre>
(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);
</pre>
The important juice is using the extend function(), and passing through the correct namespace's prototype. hope this helps, please ask if you have any questions.