jQuery报错:Uncaught TypeError: _this.attr is not a function
2024-09-03 18:57:47
问题:想通过延时把置灰的按钮再次复原,代码如下:
$("#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 --与君共勉
最新文章
- 120项改进:开源超级爬虫Hawk 2.0 重磅发布!
- js获取HTTP的请求头信息
- Android Studio导入第三方jar包
- 转:MVC 数据验证
- 使用Python 将shapefile导入mongodb
- 转:LAV Filter 源代码分析
- 这五个题你懂了javascript你就入门了
- Mysql 锁粒度
- python列表和QVariant
- javascript动画效果之多物体缓冲运动
- Spring 4.2.5 + Quartz 2.2.0整合
- c# Winform Invoke 的用法
- [android]__如何在studio中导入,使用开源的UI组件
- Json.net 反序列化 部分对象
- python 自然语言处理(四)____词典资源
- 使用mysqldump备份时为什么要加上 -q 参数(5.7默认为on)
- Java中classpath配置
- Linux 系统学习梳理_【All】
- Windows 视频Directshow开发介绍
- 1-[并发编程]-操作系统OS
热门文章
- idea 启动 Error running 'XxGatewayApplication': Command line is too long. Shorten command line for XxGatewayApplication or also for Spring Boot default
- AI 期刊会议
- 超大地图MMORPG的场景管理
- MongoDB-查询关键字/排序等
- js中两个感叹号的原理与用法分析
- sqlserver 锁表进程及执行的SQL
- unigui图形验证码
- MySQL索引选择及添加原则
- Thymeleaf th:include、th:replace引用
- otter安装、使用