radio, checkbox 체크 시 if문~
본문
안녕하세요.
form을 나누어서, 1번input을 입력하고 다음을누르면 2번input이 나오는 형식으로 작업하고 있습니다.
작업중에, input을 체크하지 않으면 다음버튼을 눌러도 활성화가 안되게 하고싶습니다.
제가 시도한 방법은 이렇습니다만.. radio중 하나만 체크되면 넘어가게 하고싶은데,
체크를 하든 안하든 체크하라고 나오네요 ㅠ 도와주십쇼!
-- html 일부 --
<div class="form-group">
<label for>글 입력 </label>
<input type="radio" name=""platform" value="615">
</div>
<div class="form-group">
<label for>글 입력 </label>
<input type="radio" name=""platform" value="616">
</div>
<div class="form-group">
<label for>글 입력 </label>
<input type="radio" name=""platform" value="617">
</div>
<div class="estimate_request_next_btn estimate_request_next_btn1">
<p>다음</p>
</div>
--html 일부--
--javascript 일부 --
$( ".estimate_request_next_btn1").click( function (){
if ($("input[name=platform]:checkbox" ).is( ":checked")){
$(".estimate_request_box1").addClass("off");
} else {
alert("체크하십시오");
} } );
--javascript 일부 --
답변 1
if ($("input[name=platform]:checkbox" ).is( ":checked")){ 를
if ($("input[name=platform]" ).is( ":checked")){ 로 한번 변경해보세요