views:

46

answers:

1
+1  Q: 

Extending MooTools

What is MooTool's equivalent of this jQuery snippet:

jQuery.fn.doSomething = function() {

};

...which allows me to do this:

$("#myElement").doSomething();
+4  A: 

You can extend the Element class by using implement method.

Element.implement({
   doSomething: function(){alert('It works')}
});

$("myElement").doSomething();
Rafael