Reputation: 35853
We can pass :checked or :hidden to :not filter as follows:
:checkbox:not(:checked)
Why cannot we pass p:hidden to :not filter as follows:
#something:not(p:hidden)
Thanks.
Upvotes: 0
Views: 536
Reputation: 943537
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>
Upvotes: 2