admin管理员组文章数量:1204645
I would like to get all form elements that don't have a specific CSS class. Example:
<form>
<div>
<input type="text" class="good"/>
<input type="text" class="good"/>
<input type="text" class="bad"/>
</div>
</form>
What selector should I use to select all elements that don't have 'bad' css class?
Thank you.
I would like to get all form elements that don't have a specific CSS class. Example:
<form>
<div>
<input type="text" class="good"/>
<input type="text" class="good"/>
<input type="text" class="bad"/>
</div>
</form>
What selector should I use to select all elements that don't have 'bad' css class?
Thank you.
Share Improve this question asked Jul 22, 2009 at 11:54 Valentin VValentin V 25.7k34 gold badges109 silver badges154 bronze badges3 Answers
Reset to default 17You can use the not() filter:
$("input").not(".bad")
You can also use the not selector:
$('input:not(".bad")').hide();
Note the quotes are not needed:
$('input:not(.bad)').hide();
See:
http://docs.jquery.com/Selectors/not
$("input:not(.bad)")
本文标签: javascriptHow to find all elements that DON39T have specific CSS class in jQueryStack Overflow
版权声明:本文标题:javascript - How to find all elements that DON'T have specific CSS class in jQuery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738687936a2106933.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论