jQuery Logging
Written by on October 19th, 2007 in Ajax News.
Dominic Mitchell has created a mini jQuery logging plugin that ties Firebug to the call chain.
This means that if you are debugging something you can quickly add a .log(”….”) in the chain:
JAVASCRIPT:
-
-
jQuery.fn.log = function (msg) {
-
console.log(”%s: %o”, msg, this);
-
return this;
-
};
-
Now, I can just stuff a call to .log() in the middle of what I’m doing to see what I’m currently addressing. e.g.
JAVASCRIPT:
$(root).find(’li.source> input:checkbox’).log(”sources to uncheck”).removeAttr(”checked”);The nice thing about logging to firebug is that each node becomes clickable in the console, so you can immediately see the context.
Source: Ajaxian
Original Article: http://feeds.feedburner.com/~r/ajaxian/~3/172132532/jquery-logging