【发布时间】:2020-11-28 15:12:45
【问题描述】:
我正在尝试禁用所有表单输入,除了那些在里面的输入
<div class="class class2 w--tab-active">...</div>
由于某种原因,这也会禁用上述输入:
$('form :input:not(.w--tab-active)').prop('disabled',true);
我也试过了:
$('form :not(.w--tab-active) :input').prop('disabled',true);
你知道怎么回事吗?
【问题讨论】:
-
删除
:not()选择器之前的空格。也可以使用 filter 方法过滤结果:$('form input').filter('form:not(.w--tab-active input)').prop('disabled, true);
标签: html jquery css-selectors