$("tr.clickable").each(function() {$(this).click(function() {
$(this).children("td:first > input").is(":checked") ?
$(this).children("td:first > input").removeAttr("checked") :
$(this).children("td:first > input").attr("checked","checked");
})});
this only checks the first row in my table (no matter which row i click on). how can i apply it so that it checks the input on the specific row i click on? thanks!
HTML:
<tbody style="height: 500px; overflow-x: hidden; overflow-y: scroll;">
<tr id="row0" class="alternate clickable">
<td> <img width="11" height="11" title="This email failed to send." alt="Failed" src="images/error_warning.png">
<br>
<input type="checkbox" value="6751" name="emailCheck[]" class="emailCheck"></td>
<td><a href="user_settings.php?id=349">
wmiller </a></td>
<td>New Fin-iQ Message</td>
<td><span class="errorText">UNKNOWN</span></td>
<td>New Bulletin Notification</td>
<td>Jun. 07/10 10:14:39 am</td>
<td><a href="emails_report.php?action=re&id=6751">Resend</a>
<br>
<a id="emailBodyToggle_6751" href="javascript:showEmail(6751)">Show</a>
</td>
</tr>
<tr id="emailBody_6751" style="display: none; text-align: left;" class="alternate">
<td colspan="7"><div>...</div></td>
</tr>
<tr id="row1" class=" clickable">
<td> <img width="11" height="11" title="This email failed to send." alt="Failed" src="images/error_warning.png">
<br>
<input type="checkbox" value="6752" name="emailCheck[]" class="emailCheck"></td>
<td><a href="user_settings.php?id=350">
mholman </a></td>
<td>New Fin-iQ Message</td>
<td><span class="errorText">UNKNOWN</span></td>
<td>New Bulletin Notification</td>
<td>Jun. 07/10 10:14:39 am</td>
<td><a href="emails_report.php?action=re&id=6752">Resend</a>
<br>
<a id="emailBodyToggle_6752" href="javascript:showEmail(6752)">Show</a>
</td>
</tr>
<tr id="emailBody_6752" style="display: none; text-align: left;" class="">
<td colspan="7"><div>...</div></td>
</tr>