Javascript
[Javascript] DOM - element
shb
2022. 3. 11. 15:11
node 를 생성할수 있다.
생성된 노드를 원하는 node 에 붙일수 있다.
document.createElement()
document.createTextNode()
E.appendChild(A) : A를 E의 마지막 child 로 append 된다.
E.insertBefore(A, B) : E 의 child 중에 B 앞에 A를 child 로 insert 한다.
E.removeChild(A) : E 의 child 중에 A 를 제거한다.
- attribute를 세팅
E.setAttribute("attribute 이름", "attribute 값");
- attribute 를 제거
E.removeAttribute("attribute 이름");
- attribute 값 리턴
E.getAttribute("attribute 이름");
- attribute 를 갖고 있는지 여부, true/false 리턴
E.hasAttribute("attribute 이름");
* appendChild()
* insertBefore()
* removeChild()