File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
2-ui/1-document/05-basic-dom-node-properties/2-tree-info Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1- Let's make a loop over ` <li> ` :
1+ ` <li> ` 를 이용한 반복문을 만들어 봅시다.
22
33``` js
44for (let li of document .querySelectorAll (' li' )) {
55 ...
66}
77```
88
9- In the loop we need to get the text inside every ` li ` .
9+ 반복문 안에서 각각의 ` li ` 안에 있는 텍스트를 가져와야 합니다 .
1010
11- We can read the text from the first child node of ` li ` , that is the text node:
11+ ` li ` 의 첫 번째 자식 노드인 텍스트 노드로부터 텍스트를 읽을 수 있습니다.
1212
1313``` js
1414for (let li of document .querySelectorAll (' li' )) {
1515 let title = li .firstChild .data ;
1616
17- // title is the text in <li> before any other nodes
17+ // title은 <li> 안에 있는 다른 노드들보다 앞에 위치한 텍스트입니다.
1818}
1919```
2020
21- Then we can get the number of descendants as ` li.getElementsByTagName('li').length ` .
21+ 그리고 ` li.getElementsByTagName('li').length ` 를 이용해 ` li ` 노드 아래에 있는 모든 ` <li> ` 태그의 개수를 가져올 수 있습니다 .
You can’t perform that action at this time.
0 commit comments