condition if two checkboxes are checked doesn't work in jquery
<p>I have two radio groups. I wish to put a condition where if pRange is checked (val=pRange)  and periodType value is 'one', 'two' or 'three', it displays a div called message. but my js code below doesn't seem to work. Any help is much appreciated.</p>

<pre><code>$("input[name$='periodType']").change(function() {
        var grpname = $(this).val();
        var pname = $("input:radio[name='mainPeriod']:checked").val();
        if (((grpname == "one") || (grpname == "two") || (grpname == "three")) &amp;&amp; (pname=="pRange")) { 
                alert( pname + ' gname= ' + 'yes'); $('.message').show; 
        }
        else { 
                alert( pname + ' gname= ' + 'no'); 
        }
 });
</code></pre>

<p>GROUP 1</p>

<pre><code>&lt;input type="radio" name="mainPeriod" id="pRange" val="pRange" /&gt;
&lt;input type="radio" name="mainPeriod" id="pHour" val="pHour" /&gt;
&lt;input type="radio" name="mainPeriod" id="pDay" val="pDay" /&gt;
&lt;input type="radio" name="mainPeriod" id="pWeek" val="pWeek" /&gt;
&lt;input type="radio" name="mainPeriod" id="pMonth" val="pMonth" /&gt;
</code></pre>

<p>GROUP 2</p>

<pre><code>&lt;input type="radio" name="periodType" val="one" /&gt;
&lt;input type="radio" name="periodType" val="two" /&gt;
&lt;input type="radio" name="periodType" val="three" /&gt;
&lt;input type="radio" name="periodType" val="four" /&gt;
&lt;input type="radio" name="periodType" val="five" /&gt;

&lt;div class="message" style="display:none;"&gt;Message&lt;/div&gt;
</code></pre>
