show and hide div tag based on checkbox selection using javascript

Solutions on MaxInterview for show and hide div tag based on checkbox selection using javascript by the best coders in the world

showing results for - "show and hide div tag based on checkbox selection using javascript"
Valentín
06 Aug 2020
1<input class="coupon_question" type="checkbox" name="coupon_question" value="1" onchange="valueChanged()"/>
2
3<script type="text/javascript">
4    function valueChanged()
5    {
6        if($('.coupon_question').is(":checked"))   
7            $(".answer").show();
8        else
9            $(".answer").hide();
10    }
11</script>
12