File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Practices & Exercises/Chapter Exercise/Chapter 8 Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ console . log ( "ineerHTML and outerHTML in js" ) ;
2+
3+ let first = document . getElementsByTagName ( 'span' ) [ 0 ]
4+
5+ console . log ( first ) ;
6+
7+ console . dir ( first ) ;
8+
9+ // console.log(document.body.firstChild.nodeName)
10+
11+ // console.log(document.body.firstElementChild.nodeName)
12+
13+ // console.log(first.innerHTML); // output: Hey I am span
14+
15+ // first.innerHTML = "Hey I am changed"; // reload the page to see the change
16+
17+ // console.log(first.outerHTML); // output: <span>Hey I am span</span>
18+
19+ // first.outerHTML = "<h1>Hey I am changed</h1>"; // reload the page to see the change
20+
21+ // first.outerHTML = "<div>Hey</div>";
22+ // console.log(document.body.firstChild); // " Hello World "
23+
24+ // console.log(document.body.firstChild.nodeValue); // "\n Hello world\n"
25+
26+ // console.log(first.textContent); // output: Hey I am span
27+
28+ // first.textContent = "Hey I am changed"; // reload the page to see the change
29+
30+ // first.hidden = true;
You can’t perform that action at this time.
0 commit comments