JS:
<script type="text/javascript">
$().ready(function () {
$(".ckbpd").bind("click", function (e) {
e.stopPropagation();
})
$('tr').click(function () {
if (!$(this).find('td input').prop("checked")) {
$(this).find('td input').prop("checked", true);
} else {
$(this).find('td input').prop("checked", false);
}
})
})
</script>
HTML
<asp:Button runat="server" ID="btnBevestigen" Text="~Bevestigen~" />
<table>
<tr>
<td>
<input type="checkbox" />
</td>
<td class="ok">
</td>
<td>
adsasdsa
</td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td class="ok">
asdsada
</td>
<td>
adsasdsa
</td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td class="ok">
asdsada
</td>
<td>
adsasdsa
</td>
</tr>
</table>
ready事件:
$().ready(function () {})
( $().ready和windows.onload()区别之后会写)
取消控件自带的click事件:
$(".ckbpd").bind("click", function (e) {
e.stopPropagation();
})
行选中事件:
$('tr').click(function () {
if (!$(this).find('td input').prop("checked")) {
$(this).find('td input').prop("checked", true);
}
else {
$(this).find('td input').prop("checked", false);
}
})