节点的创建删除克隆
//删除子节点
box.removeChild(box.children[2])
// 替换子节点 who替换who
box.replaceChild(box.children[2],box.children[0])
// 添加节点
var txt = document.createElement('p')
txt.innerHTML = 4;
box.append(txt)
// 克隆节点
var node = box.cloneNode(true);
node.id = 'box2'
box.append(node)
// insertBefore插入 。。。。之前 nextSibling .。。之后
box.insertBefore(node,box.children[0].nextSibling)
自定义属性
// 获取自定义标签属性值
var res = box.getAttribute('a');
console.log(res);
// 设置自定义标签属性
box.setAttribute('b',456)
console.log(box)