I have an ASP.NET-rendered CheckBox. When clicked, I want jQuery to capture the event, but for some reason it is not working.
This is what I'm doing so far:
ASP.NET
<table>
<tr>
<td>
<asp:CheckBox runat="server" ClientIDMode="Static"
id="testcb" name="testcb" />
</td>
</tr>
</table>
jQuery
$("#testcb").click(function () {
if ($(this).is(':checked')) alert("checked");
});
Here is the source code from the browser:
<tr>
<td>
<span name="testcb">
<input id="testcb" type="checkbox"
name="ctl00$ctl00$bodyContent$phMainContent$testcb">
</span>
</td>
</tr>
$(document).on('load' ...)or something similar.