Skip to content

Instantly share code, notes, and snippets.

@dgalarza
Forked from afahy/log.js
Created April 9, 2010 21:29
Show Gist options
  • Save dgalarza/361601 to your computer and use it in GitHub Desktop.
Save dgalarza/361601 to your computer and use it in GitHub Desktop.
// 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