工夫/JAVASCRIPT+JQUERY

[jQuery] 체크버튼으로 특정 블럭( ROW) 보이고/감추기

휘현아빠 2021. 5. 16. 11:58

    $(function(){
        $("div .CLASS NAME").click(function() {
            if ($("input[name=INPUT NAME]").is(":checked")) {
                $("#BLOCK ID").show();
            } else {
                $("#BLOCK ID").hide();
            }
        })

    });
<input type="checkbox" name="INPUT NAME">

<div id="BLOCK ID" style="display:none">
	...
</div>

※ toggleclass를 이용하는 방법도 많이 쓰인다.