data自定义属性获取方法和设置
<!--原生获取方法--> <div data-id="id=1"></div> <script> //js原生获取方法 var id = this.getAttribute('data-id'); var id = this.dataset.id
//jquery方法获取 var id = $(this).attr('data-di') var id = $(this).data('id') </script>
Sometimes you need to applaud yourself