[英]Stop the ability to click a button for a while
I have a button for next and a button for previous in my webpage, when i click one of them some data should be loaded into the page . 我在我的网页上有一个下一个按钮和一个按钮,当我点击其中一个按钮时,应该将一些数据加载到页面中。 i want to stop the ability of clicking those buttons while the data is loading. 我想停止在加载数据时单击这些按钮的功能。 can i do that??? 我能这样做吗?
<div class="final_dates_container">
<table border="1">
<tr>
<td class="left"><a href="#" onclick="prev_date();"><img class="left_image" src="./include-images/left_arrow.png"/></a></td>
<td class="right"><a href="#" onclick="next_date();"><img class="right_image" src="./include-images/right_arrow.png"/></a></td>
</tr>
</table>
</div>
Yes, if you are using ajax
then you can disable
other buttons
like 是的,如果您使用的是ajax
那么您可以disable
其他buttons
Prev click Function 上一步单击“功能”
$.ajax({
....
beforeSend:function(){
$('#next').prop('disable',true);// disable next button
}
success:function(){
//your code
$('#next').removeAttr('disable');// remove disable attribute from here
}
});
You can also do this by using ajax global function 您也可以使用ajax全局函数来完成此操作
$(document).ajaxStart(function () {
$("#btnSubmit").attr("disabled", true);
});
$(document).ajaxComplete(function () {
$("#btnSubmit").attr("disabled", false);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.