现在的位置: 首页 > 综合 > 正文

jQuery study note 4

2017年12月26日 ⁄ 综合 ⁄ 共 276字 ⁄ 字号 评论关闭

1 调试代码,不喜欢alert,但是为了兼容性问题处理,IE下不可以使用consloe,所以,写个统一的扩展吧。更多更能,慢慢扩展了。

var j=jQuery.noConflict();
j.fn.log = function (msg) {
    msg = !msg ? 'no_msg_passed' : msg;
    if(jQuery.browser.msie){ 
        alert(msg + '\n' + this.parent().html()); 
    } else {
        console.log("%s: %o", msg, this);
    }
    return this;
};
j('body').log();


2 太晚了……

抱歉!评论已关闭.