Javascript - If statement with conditions dependent on 2 separate form id
<p>I'm trying to hide a div, depending on the answers of 2 questions above. Both need to be "N" to hide. But struggling to figure out how to get both IDs as variables within the script.</p>

<p>Hope you can help...</p>

<pre><code>&lt;div&gt;&lt;table&gt;&lt;tr&gt;
&lt;td&gt;&lt;input name="v2_1a" type="radio" id="v2_1a" value="Y"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input name="v2_1a" type="radio" id="v2_1a" value="N"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;input name="v2_1b" type="radio" id="v2_1b" value="Y"&gt;&lt;/td&gt;
&lt;td&gt;&lt;input name="v2_1b" type="radio" id="v2_1b" value="N"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
$("input[name$='v2_1b']").click(function() {
$(".expand1").show();
var value1 = document.getElementById('v2_1a');
var value2 = $(this).val();
if (value1 == 'Y') {
$(".expand1").show();
}
else (value1 == 'N' &amp;&amp; value2 == 'N') {
$(".expand1").hide();
}
});
&lt;/script&gt; 
&lt;div id="expand1" class="expand1" style="display:inline-block;"&gt;
&lt;/div&gt;
</code></pre>
