整理一下原生js的dom操作

获取元素

  • getElementById()
  • getElementsByClass()
  • getElementsByTagName
  • getElementsByName

node属性

前、后、父、子

  • previousSibling
  • nextSibling
  • parentNode
  • childNode
  • children
  • firstChild
  • lastChild

操作

  • appendChild
  • insertBefore
  • removeChild
  • replaceChild
  • innerHtml
  • innerText

创建

  • CreateElement

Attribute

  • getAttribute
  • setAttribute
  • removeAttribute
  • hasAttribute
原文地址:https://www.cnblogs.com/mcad/p/10765670.html