dom设置与获取 getAttribute()setAttribute() removeAttribute()
语法 获取自定义标签的属性
ele.getAttribute("attrbute");
var p = document.getElementById("text");
console.log(p.getAttribute("class"))
添加属性
p.setAttribute(“data-color”,"red");
删除属性
p.removeAttribute(“align”);