Hiding and showing multiple selects
<p>I have 2 selects, and I want to remove, based on the values from second select, values from first. For example: if I select value 1 and 2 from second select, I want that values 2,3,4,5 are hidden, and if in the second select value is 3, I want that values 1,2,3 are hidden:</p>

<p>Select1:</p>

<pre><code>&lt;select name="select1"&gt;
&lt;option value="1"&gt;1&lt;/option&gt;
&lt;option value="2"&gt;2&lt;/option&gt;
&lt;option value="3"&gt;3&lt;/option&gt;
&lt;option value="4"&gt;4&lt;/option&gt;
&lt;option value="5"&gt;5&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>Select2:</p>

<pre><code>&lt;select name="select2"&gt;
&lt;option value="1"&gt;1&lt;/option&gt;
&lt;option value="2"&gt;2&lt;/option&gt;
&lt;option value="3"&gt;3&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>This is the code for hiding in the case that is selected 1 or 2:</p>

<pre><code>var ary=[2,3,4,5];
$('[name=select1] option').filter(function(){
return ($.inArray(parseInt(this.value),ary) &gt;-1);}).hide();
</code></pre>

<p>This code works for hiding, but I have a problem. When the code hides 2,3,4,5 on value 1 and 2, selecting value 3 in second select shows me only value 1, because others are hidden. I solved this using show(). And then 2,3,4,5 are showed but I can't hide value 1 because of the return :// I tried this, it won't work:</p>

<pre><code>var ary=[4,5];
var ary2=[1];
$('[name=select1] option').filter(function(){
return ($.inArray(parseInt(this.value),ary) &gt;-1);}).hide()&amp;&amp;($.inArray(parseInt(this.value),arry2) &gt;-1);}).show();
</code></pre>

<p>I also tried to call another function which would always refresh select1 , showing it all values, and in this functions only to use hides, I think that wouldbe right way, but I don't know how to solve it?</p>
