HTML

[attribute] HTML - readonly 속성 - 읽기전용 설정 (= readonly속성 = 리드온리속성) ※ (읽기만 가능 / 쓰기는 불가) 지정

목차
  1. readonly 예제 - <input> 경우
  2. readonly 정의
  3. readonly 구문
  4. readonly 예제 - <textarea> 경우

 

readonly 예제 - <input> 경우

 

<form action="/action_page.php">

  <label for="name">이름:</label>

  <input type="text" id="name" name="name"><br>

  <label for="site">사이트:</label>  

  <input type="text" id="site" name="site" value="Homzzang.com" readonly><br><br>

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

</form>

 

결과보기

 

readonly 정의

 

읽기 전용 설정하는 참거짓 속성.

 


 

1. readonly 속성 사용 가능 태그 종류

<input>, <textarea>

 

2.

  • readonly 지정 시 읽기만 가능하고 글쓰기나 수정은 안 됨. (단, Tab이동, 하이라이트, 내용복사 등은 가능함.)
  • JS 이용해 일정 조건(예: 체크박스 체크) 충족 전까지는 쓰기 막았다가, 조건 충족 시 글쓰기 허용 가능.
  • CSS 경우,  :read-only 선택자 이용해 읽기전용요소 선택.

 

3.

주요 브라우저 모두 지원.

 

4. MDN readonly 예제보기

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly

 

 

readonly 구문

 

  • <input readonly>
  • <textarea readonly>...</textarea>

 


[속성값]

 

없음.

 

 

readonly 예제 - <textarea> 경우

 

<textarea rows="4" cols="50" readonly>

홈짱닷컴 Homzzang.com 홈페이지 제작관리강의

</textarea>

 

결과보기 



분류 제목
attribute HTML - onafterprint 속성 - 인쇄 대화상자 닫힌 이후 이벤트 발생 시 실행할 코드 정의 (=…
attribute HTML - onbeforeprint 속성 - 인쇄 대화상자 나타나기 이전 이벤트 발생 시 실행할 코드 정의…
attribute HTML - onbeforeunload 속성 - 사용자가 웹페이지 떠날 때 떠나기 전 실행 (= onbefo…
attribute HTML - onblur 속성 ★ - 포커스 해제 이벤트 시 실행 (= onblur속성 = 온블러속성) ※ …
attribute HTML - oncanplay 속성 - 재생 시작 가능 시 실행 (= oncanplay속성 = 온캔플레이속성…
attribute HTML - oncanplaythrough 속성 - 버퍼링 위해 멈춤 없이 전체 재생 가능 시 실행 (= o…
attribute HTML - onchange 속성 ★ - 요소값 변경 이벤트 시 실행 (= onchange속성 = 온체인지속…
attribute HTML - onclick 속성 ★ - 요소 클릭 이벤트 시 실행 (= onclick속성 = 온클릭속성) ※…
attribute HTML - oncontextmenu 속성 - 마우스오른쪽메뉴선택 시 실행 (= oncontextmenu속성…
attribute HTML - oncopy 속성 - 요소의 텍스트나 이미지 태그를 복사 시 실행 (=oncopy속성 = 온카피…
attribute HTML - oncuechange 속성 - 트랙의 큐(캡션/자막) 변경 시 실행 (= oncuechange속…
attribute HTML - oncut 속성 - 요소 내용 잘라내기 시 실행 (= oncut속성 = 온컷속성) ※ oncut…
attribute HTML - ondblclick 속성 ★ - 요소 더블클릭 이벤트 시 실행 (= ondblclick속성 = …
attribute HTML - ondrag 속성 - 드래그 이벤트 시 실행할 코드 지정 (= ondrag속성 = 온드래그속성)…
attribute HTML - ondragend 속성 - 드래그 종료 시 실행 (= ondragend속성 = 온드래그엔드속성)…
15/24
목록
 홈  PC버전 로그인 일본어
그누앞단언어
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 2
웹유틸
회원센터
홈짱닷컴 PC버전 로그인