我有以下 HTML:
<label class="fileinput-button">
<span>add file...</span>
<input type="file" name="file" disabled>
</label>
我想使用label
的类名(没有按钮的ID)禁用input
元素(按钮)。
$('label.fileinput-button') ... button ... disable.
我该怎么做?
最佳答案
$('label.fileinput-button input').prop('disabled', true);
注意: .prop()
自版本 1.6 起可用
关于jquery - 如何禁用父元素类上的按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7629341/