강좌
클라우드/리눅스에 관한 강좌입니다.
기타 분류

[javascript] confirm return false 일때, radio button checked 적용되는 문제

작성자 정보

  • 캘리포니아 작성
  • 작성일

컨텐츠 정보

본문

<input type="radio" value="1" onclick="return confirmation()" name="collections"> <input type="radio" value="2" onclick="return confirmation()" name="collections"> <input type="radio" value="3" onclick="return confirmation()" name="collections"> <script> function confirmation(){ if(confirm("Are you sure!")) { //do your job } else { return false; } } </script> 



onclick="confirmation()" 클릭시 return false; 을 적용하여도  

체크값이 변경되는 문제가 발생합니다.

해결책은

onclick="return confirmation()"

을 적어주면 됩니다.


#html #javascript #radiobutton

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,015 명
  • 현재 강좌수 :  35,688 개
  • 현재 접속자 :  153 명