Difference of public and private functions.
Hello there,
I'm an intermediate jQuery user and I want to build my very first (and hopefully useful) plug in. My question is really simple. When should I use a public and when a private function into the plug in code? They both work well, so why we need them both?
- ;(function($) {
- //plugin code...
- // Private function
- function privateFunc() { };
- // Public function
- $.fn.plugin.publicFunc = function(){ };
- })(jQuery);
Thanks in advance,
John