jQuery show hide divs on radio buttons
<p>I have got a group of radio buttons that when clicked need to display a corresponding unordered list.  I have got as far as showing the correct list according to which radio button is clicked but cannot figure out how to hide the other lists that need to be hidden.  So if i click the second benefits radion then the second 'spend' ul will display and the other 'spend' uls will hide.</p>

<p>This is my jQuery:</p>

<pre><code>// hide all except first ul
$('div.chevron ul').not(':first').hide();

//
$('div.chevron &gt; ul &gt; li &gt; input[name=benefits]').live('click',function() { 

    // work out which radio has been clicked
    var $radioClick = $(this).index('div.chevron &gt; ul &gt; li &gt; input[name=benefits]');
    var $radioClick = $radioClick + 1;

    $('div.chevron &gt; ul').eq($radioClick).show();

});

// trigger click event to show spend list
var $defaultRadio = $('div.chevron &gt; ul &gt; li &gt; input:first[name=benefits]')
$defaultRadio.trigger('click');
</code></pre>

<p>And this is my HTML:</p>

<pre><code>        &lt;div class="divider chevron"&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;What benefit are you most interested in?&lt;/strong&gt;&lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="benefits" id="firstBenefit" value="Dental" checked="checked" /&gt;
                &lt;label for="firstBenefit"&gt;Dental&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="benefits" id="secondBenefit" value="Optical" /&gt;
                &lt;label for="secondBenefit"&gt;Optical&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="benefits" id="thirdBenefit" value="Physiotherapy" /&gt;
                &lt;label for="thirdBenefit"&gt;Physiotherapy, osteopathy, chiropractic, acupuncture&lt;/label&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;How much do you spend a year on Dental?&lt;/strong&gt;&lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate1a" value="£50" /&gt;
                &lt;label for="rate1a"&gt;&amp;pound;50&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate2a" value="£100" /&gt;
                &lt;label for="rate2a"&gt;&amp;pound;100&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate3a" value="£150" /&gt;
                &lt;label for="rate3a"&gt;&amp;pound;150&lt;/label&gt;
            &lt;/li&gt;           
        &lt;/ul&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;How much do you spend a year on Optical?&lt;/strong&gt;&lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate1b" value="£50" /&gt;
                &lt;label for="rate1a"&gt;&amp;pound;50&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate2b" value="£100" /&gt;
                &lt;label for="rate2a"&gt;&amp;pound;100&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate3b" value="£150" /&gt;
                &lt;label for="rate3a"&gt;&amp;pound;150&lt;/label&gt;
            &lt;/li&gt;           
        &lt;/ul&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;How much do you spend a year on Physiotherapy, osteopathy, chiropractic, acupuncture?&lt;/strong&gt;&lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate1c" value="£50" /&gt;
                &lt;label for="rate1a"&gt;&amp;pound;50&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate2c" value="£100" /&gt;
                &lt;label for="rate2a"&gt;&amp;pound;100&lt;/label&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;input type="radio" class="inlineSpace" name="spend" id="rate3c" value="£150" /&gt;
                &lt;label for="rate3a"&gt;&amp;pound;150&lt;/label&gt;
            &lt;/li&gt;           
        &lt;/ul&gt;
        &lt;label class="button"&gt;&lt;input type="submit" value="View your quote" class="submit" /&gt;&lt;/label&gt;
    &lt;/div&gt;
</code></pre>

<p>I tried using:</p>

<pre><code>$('div.chevron &gt; ul').not($radioClick).hide();
</code></pre>

<p>But that yielded a bad result where all the lists where hidden.</p>

<p>Thanks in advance.</p>
