html添加新属性data-*
<div data-id='90'>添加data属性</div> <script> let div =document.querySelector('div') let a =div.dataset['id']//获取得到 90 console.log(a) </script>
<div data-id='90'>添加data属性</div> <script> let div =document.querySelector('div') let a =div.dataset['id']//获取得到 90 console.log(a) </script>