확인란은 하나만 선택할 수 있습니다.
631 단어 확인란은 하나만 선택할 수 있습니다.
<input id="1" type="checkbox" class="dept" onclick="check(this)" />
<input id="2" type="checkbox" class="dept" onclick="check(this)" />
<input id="3" type="checkbox" class="dept" onclick="check(this)" />
js 코드는 다음과 같습니다.
//
function check(obj) {
$('.dept').attr('checked', false);//
$(obj).attr('checked', true);//
}
필기를 해라, 기억력이 안 돼!