js3秒内防止重复提交的方法(jquey防止重复提交)
导语:js 3秒内防止重复提交
<!DOCTYPE html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0,maximum-scale=1.0, user-scalable=no">
<title>js禁止重复点击/提交</title>
<script src="../bootstrap/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../js/jquery.jedate.js"></script>
<script type="text/javascript">
var checkClick = false;
function checkClick () {
NoClick();
}
function NoClick(){
if (checkClick == true) {
alert("提交中...");
return false;
}
checkClick = true;
setTimeout(function() {
checkClick = false;
}, 3000);
return true;
}
</script>
</head>
<input value="防止重复点击" type="button" onclick="return checkClick ();">
3秒内重复点击按钮效果如下:
效果图
本文内容由小玥整理编辑!