Below code snippet explains how HTML input checkbox checked unchecked event can be handled using jQuery
<input type = "checkbox" id = "chk" checked = "checked" />
<input type = "text" id = "txt" />
<script type = "text/javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$("#chk").live("click", function () {
if ($("#chk").is(":checked")) {
$("#txt").attr("disabled", "");
} else {
$("#txt").attr("disabled", "disabled");
}
});
</script>
Explanation:
In the above example the checkbox with Id “chk” has been assigned a click event handler using jQuery live function.
Inside the function it checks whether the checkbox is checked or not using the :checked property of jQuery and enables or disables the HTML input textbox.