How do you add a new method called 'debug' to jQuery's objects?
Explanation
You have to add your function to the $.fn namespace. Please note that inside the function, this will refer to the jQuery object, not a DOM object. Example:

$.fn.debug = function(){
   this.css('background','red');
}
$('p').debug();

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback