問題:想通過延時把置灰的按鈕再次復原,代碼如下:
$("#sendEmailCode").on("click", function() {
var _this = this;
_this.setAttribute("disabled",true)
setTimeout(function(){
console.log("hh");
_this.attr("disabled",false);
}, 3000)
}
js報錯:Uncaught TypeError: _this.attr is not a function
解決方案:
#源碼中的調用是用jQuery作為函數的 jQuery.noConflict();
把代碼修改成
jQuery(_this).attr("disabled",false)
就不報錯了。
參考文章:http://yoff.cn/article/13.html
--與君共勉
