整理一下原生js的dom操作 获取元素 node属性 操作 创建 Attribute

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

node属性

前、后、父、子

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

操作

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

创建

  • CreateElement

Attribute

  • getAttribute
  • setAttribute
  • removeAttribute
  • hasAttribute