现获取对象自定义对象:
<div id = 'data-test' data-my-age = "23"></div>
<script>
let age = document.getElementById("data-test")
alert(age.dataset.myAge) //dataset属性是用来获取对象上的自定义的属性值
</script>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!