|
|
|
อยากได้โค้ดสำหรับจำกัดการส่ง(กดปุ่ม) Submit รัวๆครับ |
|
|
|
|
|
|
|
ประมาณนี้
Code (PHP)
<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input[type="submit"]').prop('disabled', false);
$('input[type="submit"]').click(function() {
$('input[type="submit"]').prop('disabled', true);
setInterval(function(){
$('input[type="submit"]').prop('disabled', false);
},5000);//ตั้งเวลา 1000= 1วิ
});
});
</script>
<input type="text" name="textField" />
<input type="submit" value="send" />
|
|
|
|
|
Date :
2016-08-13 11:13:47 |
By :
thesin18598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<form method="post" aciton="" id="form1">
<input type="text" name="test" id="test" value="" />
<input type="submit" value="add" />
</form>
<script type="text/javascript">
window.formEnable = true;
$(function(){
$('#form1').submit(function(){
if (window.formEnable === false){
alert('Please wait 5 seconds before submit again');
return false;
}
if ($('#test').val()==''){
alert('please provide your name');
return false;
}
window.formEnable = false;
window.setTimeout(function(){
window.formEnable = true;
},5000);
return true;
});
});
</script>
|
|
|
|
|
Date :
2016-08-13 13:55:01 |
By :
num |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|