Skip to content

Instantly share code, notes, and snippets.

@afahy
Created April 2, 2010 19:31
Show Gist options
  • Save afahy/353585 to your computer and use it in GitHub Desktop.
Save afahy/353585 to your computer and use it in GitHub Desktop.
Simple plugin to log / dir jquery objects
// allows you to log an object while staying in the chain
(function($){
var console = ("console" in window) ? window.console : { "log": alert, "dir": alert };
$.extend($.fn, {
log: function(){
console.log(this);
return this;
},
dir: function(){
console.dir({
elements: this,
length: this.length,
selector: this.selector,
context: this.context,
});
return this;
},
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment