We can pass :checked or :hidden to :not filter as follows:
:checkbox:not(:checked)
Why cannot开发者_C百科 we pass p:hidden to :not filter as follows:
#something:not(p:hidden)
Thanks.
You can. If you could not, then either both paragraphs in this example would come out black or both would be blue, and my test shows that the first is blue and the second is black, which is what I would expect.
<!DOCTYPE HTML>
<html lang=en>
<meta charset=utf-8>
<title>Test</title>
<h1>Testing</h1>
<p id="something">testing</p>
<p id="else" style="display: none">testing</p>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
$('#something:not(p:hidden)').css('color', 'blue');
$('#else:not(p:hidden)').css('color', 'blue');
$('#else').css('display', 'block');
</script>
精彩评论