Return to Snippet

Revision: 10132
at December 9, 2008 12:24 by garside

Initial Code
$.enableConsole = false;
$.fn.console = $.console = function(method){
	if (window.console && console[method] && $.enableConsole)
		console[method].apply(this, [],1))
	return this;

// When debugging code, be sure to set:
$.enableConsole = true; // Or none of your lines will reach the console

// You can call any firebug functions through either the direct jQuery object, or in a chain:
$.console('debug', 'This is some %s text', 'debugging');

// The best part is the ability to use the firebug console chain easily:
var color = '#FFF';
$('#someElement').css('backgroundColor', color).console('log', 'Changing the background color to "%s"', color);

// And the access to the other functions of the firebug console, like time/timeEnd
$('#someElement').console('time', 'timing foo').animate({...}).console('timeEnd', 'timing foo');

Initial URL

Initial Description
A simple but powerful interface for allowing firebug access functions in the jQuery chain.

See the link above to check out the functions it accepts.

Initial Title
jQuery to Firebug Logging

Initial Tags
jquery, log

Initial Language