Answers for "checkbox click show hide div using javascript"

0

show and hide div tag based on checkbox selection using javaScript

<input class="coupon_question" type="checkbox" name="coupon_question" value="1" onchange="valueChanged()"/>

<script type="text/javascript">
    function valueChanged()
    {
        if($('.coupon_question').is(":checked"))   
            $(".answer").show();
        else
            $(".answer").hide();
    }
</script>
Posted by: Guest on September-08-2021
0

onclick checkbox hide div and unchecked show div

$(".answer").hide();
$(".coupon_question").click(function() {
    if($(this).is(":checked")) {
        $(".answer").show(300);
    } else {
        $(".answer").hide(200);
    }
});
Posted by: Guest on October-12-2020

Code answers related to "checkbox click show hide div using javascript"

Browse Popular Code Answers by Language