Post your trick

Adding your own custom functions to jquery

hide(),show(),empty()…this are predefined functions of jquery.
So, to add your own function , you just have to write small piece of code :

$.fn.myFunction = function() {
return $(this).addClass(’changed’);
}

And now, use it like this:

$(’.changePlease’).myFunction();

:D


Leave a Reply

     

     

     

Post A Trick !

How does "Kodetricks" work?

We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.



Technology

Contact Us