1 special ways to set properties for DOM:
The DataSet property of the DOM object gets the properties defined by the Data-xxx method
Since we often need to customize properties on labels to store data or state, it is easy to confuse custom attributes with HTML specification attributes if you are working in a traditional way that is cumbersome and unfamiliar with HTML specifications. For more convenient and efficient implementation of this demand, We can use the DataSet property
2using the DataSet property of the Dom object, three points to note when manipulating custom properties:1 when defining attributes on a label, prefix data-
2 when you get/set the value of a property defined by data-in JS, you get/set through the dataset
// HTML<div id= "box" data-index= "0" i= "0" ></div>//jsvar box = document.getElementById (' box '// Returns an object containing all the properties defined on the current label with data- // Returns the value of the Data-index
JavaScript Tutorial Series 43:dom object's DataSet Property mode