https://blog.csdn.net/qq_31851435/article/details/53100691
<div id="myDiv" data-attribute="value">在标签里设置H5新增的自定义属性</div>
方法一
var myDiv = document.getElementById("myDiv");
var theValue = myDiv.getAttribute("user-defined-attribute");
方法二
var myDiv = document.getElementById("myDiv"); var theValue = myDiv.dataset.attribute;