<html>
<head>
<title>Checkbox onchange event using jquery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(function(){
$("#chkCheck").change(function(){
if ($(this).is(':checked')) {
$("#txtContent").html("Checkbox Checked!");
} else {
$("#txtContent").html("Checkbox Unchecked!");
}
});
});
</script>
</head>
<body>
<div style='padding:2rem;text-align:center;'>
Check on the Check box <input type="checkbox" id="chkCheck"/>
<br>
<label id="txtContent" style="color:green;"></label>
</div>
</body>
</html>
<head>
<title>Checkbox onchange event using jquery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
$(function(){
$("#chkCheck").change(function(){
if ($(this).is(':checked')) {
$("#txtContent").html("Checkbox Checked!");
} else {
$("#txtContent").html("Checkbox Unchecked!");
}
});
});
</script>
</head>
<body>
<div style='padding:2rem;text-align:center;'>
Check on the Check box <input type="checkbox" id="chkCheck"/>
<br>
<label id="txtContent" style="color:green;"></label>
</div>
</body>
</html>