Hi I have a table like:
<table class="approvalstable">
...
<tr>
<td class="projectapproval">
<img src="../../Content/Images/stock_lock.gif" alt="locked" class="lockicon invisibleforprint" />
</td>
<td>
<input type="checkbox" class="projectcheckbox approvalcheckbox" checked="checked" />
</td>
</tr>
<tr>
<td class="projectapproval">
<img src="../../Content/Images/stock_lock.gif" alt="locked" class="lockicon invisibleforprint" />
</td>
<td>
<input type="checkbox" class="projectcheckbox approvalcheckbox" />
</td>
</tr>
<tr>
<td class="projectapproval">
</td>
<td>
<input type="checkbox" class="projectcheckbox approvalcheckbox" />
</td>
</tr>
...
</table>
So far to get the number of rows without lock images in them I have:
$('.approvalstable td.projectapproval:not(:has(img.lockicon))').length
However I have a further requirement to only get the number of rows without lock images in them that also have a checked checkbox.
Ok so to get the number with checked checkboxes:
$('.projectcheckbox:checked').length;
Can anyone tell me how to combine them though? I’m trying to get the number of rows that have both no lock images in a cell and a checked checkbox in a cell within the same row.
Try:
jsFiddle example.