Check all the radio buttons checked and get their values JQuery
<p>Using JQuery I am trying to perform validation and also get the values of all the <strong>dynamically</strong> generated Radio buttons in the page.</p>

<p>I have 10 questions on my page and each question has a Radio button group(YES/NO). </p>

<p>On click event of the Continue button I need to check all the questions are answered or not and also get the answers for all the questions.</p>

<p>this is how each question look like.</p>

<pre><code> &lt;tr&gt;
     &lt;td class="TextBold"&gt;1.&lt;/td&gt;
     &lt;td class="TextBold"&gt;Question content 1
    &lt;/td&gt;
    &lt;td class="TextBold"&gt;
    &lt;table id="ctl00_DefaultContent_ctl01" border="0"&gt;
      &lt;tr&gt;
       &lt;td&gt;
         &lt;input id="ctl00_DefaultContent_ctl01_0" type="radio" name="ctl00$DefaultContent$ctl01" value="Yes" /&gt;&lt;label for="ctl00_DefaultContent_ctl01_0"&gt;Yes&lt;/label&gt;
       &lt;/td&gt;
       &lt;td&gt;
    &lt;input id="ctl00_DefaultContent_ctl01_1" type="radio" name="ctl00$DefaultContent$ctl01" value="No" /&gt;&lt;label for="ctl00_DefaultContent_ctl01_1"&gt;No&lt;/label&gt;
       &lt;/td&gt;
      &lt;/tr&gt;
     &lt;/table&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
</code></pre>

<p>Here is what I have come up with. But I would like to give a warning to the user saying these questions are not answered without making another selector call.</p>

<pre><code>$('#btnContinue').click(function () {
    if ($(":radio:checked").size() &lt; 10)
{

}
    var result = '';
    $('input:checked').each(function () {
        result += "|" + $(this).closest('table').closest('td').prev().prev().html() + ',' + $(this).val();
    });
    alert(result);
}); 
</code></pre>
