Recently I wrote a template on how to extend jQuery and how to create your own functions. Since then I came across even smaller code snippet on how to add your own custom functions, in other words how to create plugins for jQuery. So without further ado: $.fn.myFunction = function() {
return $(this).addClass('changed');
} And now, use it like this: $('.changePlease').myFunction(); And that
return $(this).addClass('changed');
} And now, use it like this: $('.changePlease').myFunction(); And that
Comments
Post a Comment