如何禁用所有div内容 [英] How to disable all div content
本文介绍了如何禁用所有div内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我假设如果我禁用了div,所有内容也都被禁用了。
但是,内容呈灰色,但我仍然可以与它互动。
有没有办法做到这一点? (禁用div并禁用所有内容)
解决方案
上面的许多答案只适用于表单元素。禁用包含其内容的任何DIV的简单方法是仅禁用鼠标交互。例如:
$(#mydiv)。addClass(disabledbutton);
css
.disabledbutton {
pointer-events:none;
不透明度:0.4;
}
I was under the assumption that if I disabled a div, all content got disabled too.
However, the content is grayed but I can still interact with it.
Is there a way to do that? (disable a div and get all content disabled also)
解决方案
Many of the above answers only work on form elements. A simple way to disable any DIV including its contents is to just disable mouse interaction. For example:
$("#mydiv").addClass("disabledbutton");
css
.disabledbutton {
pointer-events: none;
opacity: 0.4;
}
这篇关于如何禁用所有div内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文