jQuery给CheckBox添加事件

时间:2023-03-10 07:20:24
jQuery给CheckBox添加事件
<asp:CheckBox ID="ckbTable" runat="server" Checked="false" />
<table id="table" style="display:none" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>123</td>
</tr>
</table>
$(function(){
$("#ckbTable").click(function () {
if (this.checked) {
$("#table").css("display", "block");
}
else {
$("#table").css("display", "none");
}
});
});