JQ给按钮设置置灰
你可以使用CSS属性来设置按钮为灰色,使其看起来被禁用或不可点击。你可以使用以下代码:
HTML:
<button id="myButton">按钮</button>
CSS:
#myButton {
background-color: gray;
color: white;
cursor: not-allowed;
}
JavaScript:
document.getElementById("myButton").disabled = true;
这样,按钮将被设置为灰色背景,白色文本,并且鼠标指针将显示为禁止符号。使用JavaScript的disabled属性,你还可以将按钮设置为禁用状态,使其无法点击。
原文地址: https://www.cveoy.top/t/topic/h0YP 著作权归作者所有。请勿转载和采集!