1.childNode.before()

2.childNode.after()

3.childNode.replaceWith()               //内容替换

4.parentNode.prepend()                   //插入子节点

5.parentNode.append()                    //插入子节点

 

属性方法

Element.getAttribute():读取指定属性

Element.setAttribute():设置指定属性

查找方法:

Element.querySelector()

Element.querySelectorAll()

Element.getElementsByTagName()

Element.getElementsByClassName()

生成节点

document.createElement(tagName) //用来生成HTML元素节点。

document.createTextNode(text) //用来生成文本节点

document.createAttribute(name) //生成一个新的属性对象节点,并返回它。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-29
  • 2022-01-23
  • 2021-08-07
  • 2022-12-23
  • 2021-05-10
  • 2021-09-30
相关资源
相似解决方案