How to select all 'checked' checkboxes pairs?
<p><br>
I have the following html-displayed question:  </p>

<pre><code>&lt;div id="Question1"&gt;&lt;span&gt;1. &lt;/span&gt;Which of the following have the same meaning?&lt;/div&gt;
&lt;div&gt;&lt;input type="checkbox"  id="Question1Answer1Correct" /&gt;&lt;input type="checkbox" id="Question1Answer1User"/&gt;&lt;span id="Question1Answer1"&gt;String&lt;/span&gt;&lt;/div&gt; 
&lt;div&gt;&lt;input type="checkbox"  id="Question1Answer2Correct" /&gt;&lt;input type="checkbox" id="Question1Answer2User"/&gt;&lt;span id="Question1Answer2"&gt;string&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;input type="checkbox" id="Question1Answer3Correct" /&gt;&lt;input type="checkbox" id="Question1Answer3User"/&gt;&lt;span id="Question1Answer3"&gt;Integer&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;input type="checkbox"  id="Question1Answer4Correct" /&gt;&lt;input type="checkbox" id="Question1Answer4User"/&gt;&lt;span id="Question1Answer4"&gt;int&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now I need to retrieve all answers which their "Correct" and "User" checkboxes are checked - and mark them as correct, all those whose "Correct" and "User" checkboxes are unchecked - and also mark them as correct, and mark all other answers as incorrect.  </p>

<p>I was starting to do that like so:  </p>

<pre><code>$('#checkAnswers').click(function(){            
    $.each($("input[id^='Question1Answer1']"),function(){ 

    if ($("#Question1Answer1Correct").attr('checked') &amp;&amp; $("#Question1Answer1User").attr('checked') )
{
    $('#Question1Answer1').css('color','#00AB32'); //that's green for correct
}   
});  
</code></pre>

<p>But it seems too hard for me to generalize that.<br>
Question is - how do I make this code work for all answers (you can assume of course  all answers have the same naming scheme).  </p>

<p>Thanks for your time!</p>
