css按钮设置为不可点击
- 论坛
- css按钮设置为不可点击
22 浏览
css按钮设置为不可点击
我想将按钮的CSS设置为不可点击/禁用。我有一个表单,当我点击“发送”按钮时,我想将按钮设置为禁用/不可点击。我应该如何做到这一点?
这是按钮的样式:
.good-form > .actions a, .theButton { display: inline-block; width: 540px; margin: 20px 0 10px; padding: 12px; background-color: #b6adb4; border-radius: 2px; border: 0px; text-align: center; color: #fff !important; text-decoration: none !important; font-size: 16px; font-family: 'Rubik', sans-serif; }
这是使用jQuery的代码:
首先,我尝试了这个:不起作用!
$(".good-form > .actions a, .theButton").attr('disabled', 'disabled');
其次,我尝试了这个:不起作用
$(".good-form > .actions a, .theButton").addClass('disabled');
或者
$(".good-form > .actions a, .theButton").addClass("disabled");