原生js 只能操作元素的行内样式
1.属性获取
console.log(btnlist.className); //若有多个看同时拿出
console.log(btnlist.name);
console.log(btnlist.id);
console.log(btnlist.style);
console.log(btnlist.style.width);
console.log(btnlist.style.height);
2.属性设置
- 设置类
btnlist.className="btn pink";
console.log(btnlist.classList); //返回元素的class 列表
//类添加
btnlist.classList.add("data");
//检测是否具有某个类 返回Boolean(true or false)
console.log(btnlist.classList<