일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 타입스크립트 올인원
- 타임어택
- 4주 프로젝트
- 2주 프로젝트
- 파이썬
- 리트코드
- codestates
- HTTP
- 손에 익히며 배우는 네트워크 첫걸음
- 리액트
- 회고
- python
- 백준
- LeetCode
- 렛츠기릿 자바스크립트
- til
- js
- 코어 자바스크립트
- 코드스테이츠
- 제로초
- 정재남
- 토익
- programmers
- 프로그래머스
- 리덕스
- 자바스크립트
- 타입스크립트
- 알고리즘
- javascript
- SQL 고득점 Kit
- Today
- Total
Jerry
[리뉴얼] 렛츠기릿 자바스크립트 #4 본문
기본적으로 태그 내부의 값을 선택할 때는 textContent를 사용하는 게 맞지만, 입력 태그만 value를 사용합니다. input은 대표적인 입력 태그입니다. 다른 입력 태그로는 select와 textarea가 있습니다.
입력태그.value // 입력창의 값을 가져옴
입력태그.value = 값 // 입력창에 값을 넣음
입력태그.focus() // 입력창을 하이라이트
다음 태그들의 내부 값을 가져올 때 둘 중 어떤 속성을 사용해야 하는지 표시해 보세요.
① input (value / textContent)
=> input.value
https://www.w3schools.com/tags/att_input_value.asp
HTML input value Attribute
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
② button (value / textContent)
=> button.textContent
https://www.w3schools.com/jsref/prop_node_textcontent.asp
HTML DOM textContent Property
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
③ select (value / textContent)
=> select.value
https://www.w3schools.com/jsref/prop_select_value.asp
HTML DOM Select value Property
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
④ div (value / textContent)
=> div.textContent
https://www.w3schools.com/jsref/prop_node_textcontent.asp
HTML DOM textContent Property
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
⑤ textarea (value / textContent)
=> textarea.value
https://www.w3schools.com/jsref/prop_textarea_value.asp
HTML DOM Textarea value Property
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
⑥ span (value / textContent)
=> span.textContent
https://www.javascripttutorial.net/javascript-dom/javascript-textcontent/
'Front > JavaScript' 카테고리의 다른 글
[JavaScript] var, let, const 의 차이점 (0) | 2023.02.21 |
---|---|
[JavaScript] 호이스팅(Hoisting)이란? - 호이스팅이란 (0) | 2023.02.20 |
[리뉴얼] 렛츠기릿 자바스크립트 #3 (0) | 2022.01.06 |
[리뉴얼] 렛츠기릿 자바스크립트 #2 (0) | 2022.01.04 |
[리뉴얼] 렛츠기릿 자바스크립트 #1 (0) | 2022.01.03 |