Yes. You can add methods to any function, but ideally, if you're
calling sub functions, you should use $.myPlugin as an object, rather
than a function.

(function($){
   $.myPlugin = {
      myMethod: function(){ alert('called'); }
   }

})(jQuery);

$.myPlugin.myMethod();

On Apr 7, 12:03 pm, Geuintoo <drummerb...@gmail.com> wrote:
> Hy
>
> (function($){
>
>         $.myPlugin = function(){
>
>              holla: function(){
>                 alert('holla');
>             }
>         }
>         $.myPlugin.hello = function(){
>           alert('hello von Plugin');
>         }
>
> })(jQuery);
>
> // Works finde:
> $.myPlugin.hello();
>
> // It does not work. Why?
> $.myPlugin.holla();
>
> Is there a posibility to write a method in:
>
> ... snip
> $.myPlugin = function(){
>
>              // Write methode here
>             }
>         }
> ...snip
>
> So that
>   $.myPlugin.holla();
> will work?
>
> Thanks!

Reply via email to