- // 允许链式日志记录
- jQuery.log = jQuery.fn.log = function (msg) {
- if (console){
- console.log("%s: %o", msg, this);
- }
- return this;
- };
- // 用法:
- $('#someDiv').hide().log('div hidden').addClass('someClass');
- //该片段来自于http://www.codesnippet.cn/detail/040120131275.html
来源: http://www.codesnippet.cn/detail/040120131275.html