confusion in jquery parents selector with hasClass function
<pre><code>var allChecked = $('.inboxCheckbox:checked');

if(allChecked.length &gt; 0){
    var messageIds = new Array();
    var parentRow = null;
    allChecked.each(
        function(){
            parentRow = $(this).parents('tr'); 
            if(!(parentRow.hasClass('gradeA'))){
                parentRow.addClass('gradeA');
                increaseUnreadMessage();
            }
            parentRow = null;
            messageIds.push($(this).val());
        }
    );

}else{
    showInsMessage('&lt;b class="redTxt"&gt;Please Select At Least One Message&lt;/b&gt;');
}
</code></pre>

<p>i have multiple rows with once checkbox in each row... i was trying to add class gradeA to each row if checkbox is checked.... i do not want to call addClass if it already has class gradeA.... when i select multiple rows then it adds class to only one row. does that mean </p>

<p>lets say i have three rows  with checkbox in each row and i select each checkbox when i run 
<code>$(':checked').each(
  $(this).parents('tr')
)</code>does it select all the rows with checked boxes or only the specfic parent row.... my assuption was it only gives the specific parent row..... if it gives specific row then it should work .. but once i add a class to parent row and move to another row then parentRow.hasClass('gradeA') return true... i am confused now if it checks all the row with checkboxes then is there any way to select specific parent row......</p>

<p>Thanks for reading</p>
