开发者

How to use jQuery to log values to Firebug Console?

开发者 https://www.devze.com 2023-02-10 03:22 出处:网络
I just wonder if there is a way to use jQuery to log some va开发者_运维百科riable values to Firebug console for debugging purpose?jQuery is just a library for JavaScript, so you can just use the conso

I just wonder if there is a way to use jQuery to log some va开发者_运维百科riable values to Firebug console for debugging purpose?


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

console.log(myVar);


(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!");


It's not jquery, just Firebug API:

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

精彩评论

暂无评论...
验证码 换一张
取 消