HTML按钮无法点击没有被禁用 [英] html button not clickable without being disabled
问题描述
由于IE浏览器(LT; 8)没有让我改变一个残疾人按钮的文本颜色,并引入了一个可怕的阴影(浮雕效果),我想模仿的是一个禁用按钮的行为。如果有表单上输入错误,此按钮将被禁用。
Since IE (<8?) does not let me change the text color of a disabled button, and introduces a horrible shadow (embossed effect), I want to mimic the behaviour of being a disabled button. This button will be disabled if there are input errors on the form.
而不是禁用我可以改变类JS当表单验证发生变黑按钮等。我也想要做的就是让它不可点击,以及使用户无法提交表单。 (如何)我能做到这一点?
Instead of disabling I can change the class in JS to darken the button etc when form validation takes place. What I also want to do is make it unclickable as well so that the user can not submit the form. (How) can I do this?
感谢
推荐答案
由于您使用的&LT这不会解决您的问题; IE10,但对于那些谁使用现代浏览器,并回答了原来的问题:
IE10+ & Modern Browsers Answer
This won't solve your issue since you're using < IE10, but for those who are using modern browsers and to answer the original question:
HTML按钮无法点击,而不禁用
html button not clickable without being disabled
...这工作简单地放;优雅:
...this works simply & elegantly:
.no-click {
pointer-events: none;
}
就这个类添加到您的用户界面:
Just add this class to your UI:
<button class="no-click">
这篇关于HTML按钮无法点击没有被禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!