Javascript 禁用Semanticu中的按钮,但不';你不能让它看起来残疾吗?

Javascript 禁用Semanticu中的按钮,但不';你不能让它看起来残疾吗?,javascript,html,semantic-ui,Javascript,Html,Semantic Ui,document.getElementById(“b1”).disabled=true 正文{ 填充:1em; } 红色 橙色 语义UI正在使用此特定CSS规则使其看起来褪色: .ui.button:disabled { opacity: 0.45 !important; } 您可以强制按钮的不透明度为1: let btn = document.getElementById("b1"); btn.disabled = true; btn.style = 'opacity: 1 !im

document.getElementById(“b1”).disabled=true
正文{
填充:1em;
}

红色
橙色

语义UI正在使用此特定CSS规则使其看起来褪色:

.ui.button:disabled {
    opacity: 0.45 !important;
}
您可以强制按钮的不透明度为
1

let btn = document.getElementById("b1");
btn.disabled = true;
btn.style = 'opacity: 1 !important';
让btn=document.getElementById(“b1”);
btn.disabled=true;
btn.style='不透明度:1!重要的",
正文{
填充:1em;
}

红色
橙色

与css的
有三个主要区别:禁用了可以在dev tools elements inspector中检查的
状态

只需覆盖您需要返回的内容,使其看起来正常即可。如果只希望某个特定按钮显示正常,请使选择器更具体

.ui.red.button:disabled {
   opacity:1!important;
   cursor:pointer!important;// not sure if you want these 2
   pointer-events:auto!important;
}