Making a private function public
Hi,
I've got a plugin which is structured as follows:
(function($) {
$.fn.MyFunction = function(o) {
// Here we have some parameters
return this.each(function() {
// here we have some private functions
// I want a public function here
// I have been suggested the following:
$.extend(jQuery(this).get(0), {
MyExternalFunction : function(index) {
// some internal references here
}
});
};
})(jQuery);
So what I'm looking for is how to reference MyExternalFunction from my html script. I've tried simply using MyExternalFunction(index) but I get function undefined. Alternatively should this be done a different way?
Many thanks