/ Published in: jQuery
URL: http://getfirebug.com/logging.html
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.
Expand |
Embed | Plain Text
$.enableConsole = false; $.fn.console = $.console = function(method){ if (window.console && console[method] && $.enableConsole) console[method].apply(this, [].splice.call(arguments,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');
You need to login to post a comment.
