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()

 

 

 

'Javascript' 카테고리의 다른 글

[Javascript] AJAX  (0) 2022.03.11
[Javascript] setInterval  (0) 2022.03.11
[Javascript] DOM - node  (0) 2022.03.11
[Javascript] DOM - event  (0) 2022.03.11
[Javascript] DOM (Document Object Model) - get  (0) 2022.03.11