<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="wrap" zy="123"></div>
<script>
/*
* 自定义标签属性
* -getAttribute()
* -setAttribute()
* -removeAttribute()
*
* 可以使用这3个操作合法的标签但是一般不用
* 但是想要完全移除只能使用removeAttribute
*/
let oWrap = document.getElementById('wrap');
//不合法的标签是不能用点直接操作的
// oWrap.zy = '234';
// console.dir(oWrap.zy);
//获取自定义标签属性
console.log(oWrap.getAttribute('zy'));
//设置自定义标签属性
oWrap.setAttribute('zy' , '456');
oWrap.setAttribute('yy' , '789');
//移除自定义标签属性
oWrap.removeAttribute('zy');
</script>
</body>
</html>