我有下表,其中包含每行中的复选框。当复选框状态发生变化(选中/未选中)时,相应的行需要以黄色突出显示。我们如何使用 jQuery 来实现它?
注意:我使用的是jQuery 1.4.1吗?不支持“开”。
注意:我正在尝试学习 jQuery。请不要推荐任何第三方插件。我正在尝试通过手动编码来学习它。
<html>
<table class="commonGrid" cellspacing="0" id="detailContentPlaceholder_grdGarnishmentState"
style="border-collapse: collapse;">
<thead>
<tr>
<th scope="col">
<a >
Country Code</a>
</th>
<th scope="col">
<a >
State</a>
</th>
<th scope="col">
Independent Order Status
</th>
<th scope="col">
Standard Order Status
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
USA
</td>
<td>
<span id="detailContentPlaceholder_grdGarnishmentState_lblState_0">Alaska</span>
</td>
<td>
<span class="independantOrder">
<input id="detailContentPlaceholder_grdGarnishmentState_chkIndependentOrderStatus_0"
type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl02$chkIndependentOrderStatus"
checked="checked" /></span>
</td>
<td>
<span class="standardOrder">
<input id="detailContentPlaceholder_grdGarnishmentState_chkStandardOrderStatus_0"
type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl02$chkStandardOrderStatus"
checked="checked" /></span>
</td>
</tr>
<tr style="background-color: #E5E5E5;">
<td>
USA
</td>
<td>
<span id="detailContentPlaceholder_grdGarnishmentState_lblState_1">Arkansas</span>
</td>
<td>
<span class="independantOrder">
<input id="detailContentPlaceholder_grdGarnishmentState_chkIndependentOrderStatus_1"
type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl03$chkIndependentOrderStatus" /></span>
</td>
<td>
<span class="standardOrder">
<input id="detailContentPlaceholder_grdGarnishmentState_chkStandardOrderStatus_1"
type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl03$chkStandardOrderStatus"
checked="checked" /></span>
</td>
</tr>
</tbody>
</table>
</html>