gpt4 book ai didi

jquery - 如何禁用父元素类上的按钮?

转载 作者:行者123 更新时间:2023-12-01 08:20:32 24 4
gpt4 key购买 nike

我有以下 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com