[英]How to disable page content using javascript when the form is submitted
In my application when i click form submit, service call happens. 在我的应用程序中,当我单击“表单提交”时,就会发生服务呼叫。 When the service call happens I need to I need to disable the page conetent til the next page loads. 发生服务呼叫时,我需要禁用页面提示直到下一页加载。
As i have given cursor:wait the mouse pointer changes to loading symbol and does not allow to click on the page. 正如我给定的cursor:wait一样,鼠标指针变为加载符号,并且不允许单击页面。 But still i could use tab and enter or change the values in the page. 但是我仍然可以使用tab并在页面中输入或更改值。
Can anyone tell the code to disable page content using transparent image? 谁能告诉代码使用透明图像禁用页面内容?
You could do that easier than with a transparent image : 您可以比使用透明图像更容易做到这一点:
$('body.waiting > *').on('click', function(e) {
e.preventDefault();
});
I think that you should only disable the submit input for example : 我认为您应该仅禁用提交输入,例如:
$('input').attr('disabled', 'disabled');
With a "overlay", add an absolute div at the top of your page : 使用“覆盖”,在页面顶部添加一个绝对div:
<div id="overlay" style="position:absolute;background:url('trans.png');left:0;top:0;width:100%;height:100%;display:none;"></div>
And than simply show it when your form is submitted : 而不是在提交表单时简单地显示它:
$('#overlay').show();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.