반응형
Text 객체
텍스트 객체는 텍스트 노드에 대한 DOM 객체로 CharcterData를 상속 받는다.
<p id="jinseok1"><span>kim jin seok</span></p>
<p id="jinseok2">
<span>kim jin seok</span>
</p> <!--줄바꿈이 존재-->
<script>
var t1 = document.getElementById('jinseok1').firstChild;
var t2 = document.getElementById('jinseok2').firstChild;
console.log(t1.firstChild.nodeValue);
try{
console.log(t2.firstChild.nodeValue);
} catch(e){
console.log(e);
}
console.log(t2.nextSibling.firstChild.nodeValue);
</script>
값
텍스트 노드의 값을 가져오는 API
- data
- nodeValue
조작
- appendData()
- deleteData()
- insertData()
- replaceData()
- subStringData()
생성
- docuemnt.createTextNode()
반응형
'프로그래밍 개발 > JS 웹' 카테고리의 다른 글
Javascript Text 객체 - 조작 API (0) | 2020.11.20 |
---|---|
Javascript Text 객체 - 값 API (0) | 2020.11.20 |
Javascript Document 객체 (0) | 2020.11.20 |
Javascript Node 객체 - jQuery 노드 변경 API (0) | 2020.11.20 |
Javascript Node 객체 - 문자열로 노드 제어 (0) | 2020.11.20 |
댓글