我有过
var $set = $('.foo,.bar').filter(
function() {return $(this).parents('.baz').length < 1;});
作为选择其类为foo
或bar
的所有元素的一种方式,并且这些元素不是其类为baz
的元素的后代。有没有一个选择器可以在不需要过滤lambda的情况下完成同样的事情?
<div class='foo'/><!--match this-->
<div class='bar'/><!--match this-->
<div class='baz'>
<div class='foo'/> <!--don't match this-->
</div>
https://stackoverflow.com/questions/965816
复制相似问题