How do I use the data- attribute to pass values with jQuery?

前端 未结 4 1483
后悔当初
后悔当初 2021-02-19 07:17

I\'d like to know more about using data-* attributes with HTML and its use within jQuery. I\'m simply trying to retrieve data-attribute-name=\"a value\" with .data() and

4条回答
  •  感动是毒
    2021-02-19 08:08

    set the data attribute as per your condition

     Edit
    
        function onEdit(obj) {
         console.log(this.getAttribute("data-lan")); //my-data
        }
    

提交回复
热议问题