我需要选择未使用jQuery选择的所有<option>
标签(.just_added select option
)。所有未选择的选项标签
这是我走到这一步......
$('.just_added select option:selected');
的问题是,它会选择全部所选<option>
标签,但我需要选择未选择的所有<option>
标签。
任何想法?感谢您的建议!
我需要选择未使用jQuery选择的所有<option>
标签(.just_added select option
)。所有未选择的选项标签
这是我走到这一步......
$('.just_added select option:selected');
的问题是,它会选择全部所选<option>
标签,但我需要选择未选择的所有<option>
标签。
任何想法?感谢您的建议!
您可以使用:not
[docs]:
$('.just_added select option:not(:selected)');
或者没有jQuery的伪选择(使用.not()
[docs]法):
$('.just_added select option').not(function() {
return this.selected;
});
$('.just_added select option:not(:selected)');
的not-selector应该你你想要什么:
$('.just_added select option:not(:checked)');