Help with getting element with jQuery
<p>I posted a similar question and it got answered correctly but it wasn't really what I was after (my bad).</p>

<p>Let's say I have the HTML:</p>

<pre><code>&lt;TD nowrap="true" valign="top" width="190px" class="ms-formlabel"&gt;
&lt;H3 class="ms-standardheader"&gt;
        &lt;nobr&gt;Islands&lt;/nobr&gt;
    &lt;/H3&gt;&lt;/TD&gt;
        &lt;TD valign="top" class="ms-formbody"&gt;
            &lt;span dir="none"&gt;&lt;table&gt;
            &lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="Tasmania"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl00" /&gt;&lt;label for="..."&gt;Tasmania&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="Greenland"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl01" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl01" /&gt;&lt;label for="..."&gt;Greenland&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="Hawaii"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl02" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl02" /&gt;&lt;label for="..."&gt;Hawaii&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;/table&gt;&lt;/span&gt;
&lt;/TD&gt;
&lt;TD nowrap="true" valign="top" width="190px" class="ms-formlabel"&gt;
&lt;H3 class="ms-standardheader"&gt;
        &lt;nobr&gt;Countries&lt;/nobr&gt;
    &lt;/H3&gt;&lt;/TD&gt;
        &lt;TD valign="top" class="ms-formbody"&gt;
            &lt;span dir="none"&gt;&lt;table&gt;
            &lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="Australia"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl00" /&gt;&lt;label for="..."&gt;Australia&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="Greece"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl01" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl01" /&gt;&lt;label for="..."&gt;Greece&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="ms-RadioText" title="UK"&gt;&lt;input id="ctl00_m_g_f1c8ac33_8a36_42be_8901_5201d5b9eede_ctl00_ctl04_ctl02_ctl00_ctl00_ctl04_ctl00_ctl02" type="radio" name="ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons" value="ctl02" /&gt;&lt;label for="..."&gt;UK&lt;/label&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;/table&gt;&lt;/span&gt;
&lt;/TD&gt;
</code></pre>

<p>Depending on which Island is selected I want to hide/show some other fields:    </p>

<pre><code>$("input[name=ctl00$m$g_f1c8ac33_8a36_42be_8901_5201d5b9eede$ctl00$ctl04$ctl02$ctl00$ctl00$ctl04$ctl00$RadioButtons]:radio").change(function() {
        var title = $(this).next().text();
        if(title == "Tasmania")
        {
            $('nobr:contains("Extra column")').closest('tr').hide();
        }
        else
        {
            $('nobr:contains("Extra column")').closest('tr').show();
        }
    });
</code></pre>

<p>which works and with the other radio button group I want to hide/show elements based on what country is selected. I prefer to not use these long id's and the closest unique identifier for the group is what's between the  tags, i.e. </p>

<pre><code>&lt;nobr&gt;Islands&lt;/nobr&gt;
&lt;nobr&gt;Countries&lt;/nobr&gt;
</code></pre>

<p>I started with trying to get the name for the radio button groups into variables but had no luck</p>

<pre><code>var rb1 = $('nobr:contains("Extra column")').parent().parent().next().children().children().children().attr('id');
alert(rb1);
</code></pre>

<p>but I don't get the popup (code after executes successfully), how would you get the radio button group name by starting at Islands?</p>

<p>Thanks in advance.</p>
