Show and Hide Div using input Checkbox

Example 1:
$("#inputCheck").click(function(){
    if($(this).is(":checked")){
        $(".contentDiv").slideDown();
    }
    else {
        $(".contentDiv").slideUp();
    }
});
Example 2:
$('#inputCheck').change(function() {
    $('.contentDiv').slideToggle();
});
HTML:
<input type="checkbox" id="inputCheck">
<div class="contentDiv">Content Goes here...</div>

Author: Raghava

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *


*

'