-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs13_DOM.html
More file actions
38 lines (32 loc) · 1.21 KB
/
js13_DOM.html
File metadata and controls
38 lines (32 loc) · 1.21 KB
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
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="one">
<div id="cat">
자식
<div id="dog">
멍멍
</div>
</div>
</div>
<script>
//p는 단락 tag : 단ㄹ학 내부에 단락 보유는 고려
// 고려사항 : dom으로 제어 가능한 tree 구조가 제약받는 듯한 느낌
console.log(document.getElementById("one").firstChild.nodeName[1]);
console.log(document.getElementById("one"));
console.log(document.getElementById("one"));
console.log(document.getElementById("one").nodeName);
console.log(document.getElementById("one").firstChild);
console.log(document.getElementById("one").lastChild);
console.log(document.getElementById("one").lastChild.previousSibling);
console.log(document.getElementById("dog").firstChild);
console.log(document.getElementById("one"));
setTimeout(() => {document.getElementById("dog").previousSibling.nodeValue = "유재석";}, 5000);
</script>
</body>
</html>