if ($ && $.fn) {
$.log = (window['console'] && typeof(console.log)=='function') ?
function () { console.log.apply(console, arguments); } :
$.noop;
$.fn.dump = function (tag) {
var args = Array.prototype.slice.call(arguments);
args.push(this);
$.log.apply($, args);
return this;
}
}
// use
$.log('ok');
$('img').dump();
$('div').dump('my tag');
2014-02-18 22:46
[jQuery] $.log 與 $.fn.dump
記錄一下,偷懶的 console.log
分類:
工作備忘,
JavaScript,
jQuery
相關文章 :
訂閱:
張貼留言 (Atom)
0 回應:
張貼留言