HTML DOM 텍스트 영역 객체
텍스트 영역 개체
Textarea 객체는 HTML <textarea> 요소를 나타냅니다.
텍스트 영역 개체에 액세스
getElementById()를 사용하여 <textarea> 요소에 액세스할 수 있습니다.
예시
var x = document.getElementById("myTextarea");
팁: 양식의 요소 컬렉션을 검색하여 <textarea> 요소에 액세스할 수도 있습니다 .
텍스트 영역 개체 만들기
document.createElement() 메서드를 사용하여 <textarea> 요소를 만들 수 있습니다.
예시
var x = document.createElement("TEXTAREA");
텍스트 영역 개체 속성
Property | Description |
---|---|
autofocus | Sets or returns whether a text area should automatically get focus when the page loads |
cols | Sets or returns the value of the cols attribute of a text area |
defaultValue | Sets or returns the default value of a text area |
disabled | Sets or returns whether the text area is disabled, or not |
form | Returns a reference to the form that contains the text area |
maxLength | Sets or returns the value of the maxlength attribute of a text area |
name | Sets or returns the value of the name attribute of a text area |
placeholder | Sets or returns the value of the placeholder attribute of a text area |
readOnly | Sets or returns whether the contents of a text area is read-only |
required | Sets or returns whether the text area must be filled out before submitting a form |
rows | Sets or returns the value of the rows attribute of a text area |
type | Returns the type of the form element the text area is |
value | Sets or returns the contents of a text area |
wrap | Sets or returns the value of the wrap attribute of a text area |
텍스트 영역 개체 메서드
Method | Description |
---|---|
select() | Selects the entire content of a text area |
표준 속성 및 이벤트
Textarea 객체는 표준 속성 과 이벤트 도 지원합니다 .
관련 페이지
HTML 튜토리얼: HTML 양식
HTML 참조: HTML <textarea> 태그