jquery.console.log.js
Originally from: https://gist.github.com/jlbruno/397528
jQuery.fn.clog = function(msg) {
var txt = msg ? msg : "";
if (console && typeof console.log != "undefined") {
console.log('%o ', this, txt);
}
return this;
}
- Use
.clog()
in the middle of your chain to make sure you have the proper object before you continue. it will log the current jquery object to the console. - Example:
$('.selector').find('children').clog().addClass('css');
- You can pass it a msg to log out as well
.clog('this should be children')
Written by Jeff L
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#