HTML
<body>
<span>test</span>
<span>test</span>
<span>test</span>
<span id="show">aaaaaa</span>
</body>
JS
$('body').hide();
$('#show').show();
Why doesn’t this work? How can I make it work?
Now all is hidden, but if I use $('#show').show(); it should make #show visible. Is this possible? If yes, how?
I want hide all elements without #show, but I can’t modify the HTML.
To hide all elements without
id="show", you can use thenotfunction:or the
:notpsuedoselector:Edit: to also show all children of #show, add that to the not selector:
http://jsfiddle.net/ZD7gm/3/