dom dataset getAttribute
作者:互联网
<ul> <li data-src="srcvalue" id="myLi">123456</li> </ul> <script> var myLi = document.getElementById('myLi'); //var newDom = document.createElement('p'); // document.write(newDom.outerHTML); // document.body.append(newDom); //newDom.innerHTML = 'hello222'; // document.write(myLi.getAttribute('data-src')); right native getAttribute // document.write($(myLi).attr('data-src')); right , jquery dom.attr document.write(myLi.dataset); right </script>
标签:dataset,right,dom,getAttribute,myLi,write,newDom,document 来源: https://www.cnblogs.com/dhjy123/p/15984818.html