How to select or exclude multiple elements with jQuery?
<p>I have something like the following:</p>

<pre><code>&lt;div id="div1" style="display: block;"&gt;
text
&lt;/div&gt;

&lt;div id="div2" style="display: none;"&gt;
text
&lt;/div&gt;

&lt;div id="div3" style="display: none;"&gt;
text
&lt;/div&gt;
</code></pre>

<p>When a certain event happens, I want to hide all but one div. So, for instance, I might want to show div2, while hiding div1 and div3. The problem is that the number of divs is arbitrary, so I can't simply go:</p>

<pre><code>$("#div1").css("display", "none");
$("#div2").css("display", "block");
$("#div3").css("display", "none");
</code></pre>

<p>Because there might be one div or there might be four.</p>

<p>How can I do this with jQuery?</p>
