ZaZaKi, a web developer Between Manchester UK & Rotterdam NL. © 2015-2024.

jQuery Checkbox if else

 <!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){  

$("#check").hide();

$("#checkbox").click(function(){   
    if(this.checked){
        $("#check").show();
	$("#uncheck").hide();
     }else{
    $("#uncheck").show();
	$("#check").hide();
    }
 }); 
 
});
</script>
</head>
<body> 

    <h1>Checkbox if else </h1>
    <input type="checkbox" id="checkbox">
    <div id="check">Checked </div>
    <div id="uncheck">Unchecked </div>

</body>
</html> 
Categroy:
Front-end , JQuery