How to use jQuery to log values to Firebug Console?

爱⌒轻易说出口 提交于 2019-12-14 03:48:57

问题


I just wonder if there is a way to use jQuery to log some variable values to Firebug console for debugging purpose?


回答1:


jQuery is just a library for JavaScript, so you can just use the console.log() function:

console.log(myVar);



回答2:


(function($) {
    $.log = function() {
       if( 'console' in window )
            console.log.apply(null, arguments);
    };
}(jQuery));


$.log("hello world, I'm just kidding with this answer, please upvote it anyway!");
$.log("You should really just call console.log() directly");
$.log("Over and out!");



回答3:


It's not jquery, just Firebug API:

console.log(2,4,6,8,"foo",bar)


来源:https://stackoverflow.com/questions/4969279/how-to-use-jquery-to-log-values-to-firebug-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!