HTML

[attribute] HTML - checked 속성 ★ - 미리 (체크박스/라디오) 체크 여부 지정 (= checked속성 = 체크트속성)

목차
  1. checked 예제 - <input type="checkbox"> 경우
  2. checked 정의
  3. checked 구문
  4. checked 예제 - <input type="radio"> 경우
  5. checked 예제 - 페이지 로드 완료 후, JS로 체크 적용

 

checked 예제 - <input type="checkbox"> 경우

 

<form action="/action_page.php" method="get">

  <input type="checkbox" name="html" value="html">

  <label for="html"> HTML</label><br>

  <input type="checkbox" name="css" value="css">

  <label for="css"> CSS</label><br>

  <input type="checkbox" name="js" value="js" checked>

  <label for="js"> JS</label><br><br>

  <input type="submit" value="확인">

</form>

 

결과보기

 

checked 정의

 

페이지 로드 시, (체크박스/라디오)가 미리 선택되어 있어야 하는지 지정하는 참거짓 속성.

 


 

1. checked 속성 사용 가능 태그

<input type="checkbox">, <input type="radio">

 

2.

JS 이용해, 페이지 로드 완료 후 지정도 가능.

 

3.

모든 브라우저 지원.

 

 

checked 구문

 

  • <input type="checkbox" checked>
  • <input type="radio" checked>

 


[속성값]

 

없음.

 

 

checked 예제 - <input type="radio"> 경우

 

<form action="/action_page.php" method="get">

  <input type="radio" id="html" name="html" value="html">

  <label for="html"> HTML</label><br>

  <input type="radio" id="css" name="css" value="css">

  <label for="css"> CSS</label><br>

  <input type="radio" id="js" name="js" value="js" checked>

  <label for="js"> JS</label><br><br>

  <input type="submit" value="확인">

</form>

 

결과보기

 

checked 예제 - 페이지 로드 완료 후, JS로 체크 적용

 

<form action="/action_page.php" method="get">

  <input type="radio" id="html" name="html" value="html">

  <label for="html"> HTML</label><br>

  <input type="radio" id="css" name="css" value="css">

  <label for="css"> CSS</label><br>

  <input type="radio" id="js" name="js" value="js">

  <label for="js"> JS</label><br><br>

  <input type="submit" value="확인">

</form>


<script>

window.addEventListener('DOMContentLoaded', function() {

    document.getElementById('js').checked = true;

});

</script>

 

결과보기


방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

분류 제목
style HTML - <footer> 태그 ★ - 단락꼬릿말 (= footer태그 = footer요소 = 푸터태그 =…
style HTML - <main> 태그 ★ - 문서기본내용 (= main태그 = 메인태그)
style HTML - <section> 태그 ★ - 연관된 문서단락 (= section태그 = 섹션태그, IE9)
style HTML - <article> 태그 ★ - 자족적인 독립콘텐츠 (= 아티클태그 = article태그. IE9…
style HTML - <aside> 태그 ★ - 관련 별도 콘텐츠 (= aside태그 = 어사이드태그)
style HTML - <details> 태그 - 토글 가능한 세부사항(상세사항)을 표시 (= details태그 = 디…
style HTML - <dialog> 태그 - 대화박스 (= 대화상자 = dialog태그 = 다이알로그태그) (HTM…
style HTML - <summary> 태그 - 세부사항의 머리글 (= summary태그 = 서머리태그 = 써머리태…
programming HTML - <embed> 태그 - 외부동영상재생 (= embed태그 = 엠베드태그, HTML5추가)
intro HTML - 구형브라우저에서 HTML5 사용 (+ HTML요소생성법)
deprecated HTML - <nobr> 태그 - 줄바꿈안하기 (= nobr태그 = 노비알태그)
etc HTML - <tt> 태그 - 텔레타이프 텍스트 (= tt태그 = 티티태그)
attribute HTML - Attribute ★ - 속성종류 (= 전역속성 + 이벤트속성 + 그외속성)
attribute HTML - Global Attribute - 전역속성 종류
attribute HTML - Event Attribute - 이벤트속성종류
9/23
목록
  • 채팅방
  • 필독
1. 채팅창 헤드에서 접속자 확인 2. 닉네임 클릭해 1:1 채팅 가능 3. 닉네임 클릭해 귓속말 가능 4. 닉네임 클릭해 호출하기 가능 5. 우하단 클릭해 환경 설정 가능 6. 의뢰글 작성 후 의뢰 상담 가능 7. 질문글 작성 후 질문 상담 가능 8. 채팅방에 개인정보 입력 금지 9. 채팅방에 광고 욕설 비방 금지
 홈  PC버전 로그인 일본어
웹디자인언어
서버관리언어 1
고급코딩언어
그누보드 1
제작의뢰
Q&A
커뮤니티 1
웹유틸
회원센터
홈짱 PC버전 로그인