jquery设置按钮停顿3秒不可用
2019/6/29 22:38:42
本文主要是介绍jquery设置按钮停顿3秒不可用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<title> my name is lian lily</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var times = 0
function show(obj) {
$("#btn_"+obj).attr("disabled","disabled");//设置button不可用
times++;
if(times == 2){
alert(obj);
times = 0;
$("#btn_"+obj).removeAttr("disabled");
return ;
}
//$("#frm"+obj).submit();
setTimeout("show("+obj+")" , 3000);
}
</script>
</head>
<body>
<form action ='post.php' method="post" name="frm1" id="frm1">
<input type="button" name="btn_1" id="btn_1" value="提交1" onclick="show(1)" />
</form>
<form action ='post.php' method="post" name="frm2" id="frm2">
<input type="button" name="btn_2" id="btn_2" value="提交2" onclick="show(2)"/>
</form>
</body>
</html>
这篇关于jquery设置按钮停顿3秒不可用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-06jquery对css样式(jquery中的css方法)-icode9专业技术文章分享
- 2023-05-27JQuery的认识和安装
- 2023-01-06JQuery应用技巧:如何定义 HTML 模板并使用 JQuery 进行加载-icode9专业技术文章分享
- 2022-09-29复习-jQuery
- 2022-09-04Python3项目初始化10-->前端基础jquery、ajax,sweetalert--更新用户改造
- 2022-08-30day 27 jquery
- 2022-08-29jQuery筛选器,bootstrap
- 2022-08-20JQuery事件绑定
- 2022-08-20JQuery案例
- 2022-08-07关于jQuery的学习