How to set and get data attributes in HTML?
Question
There is a div with an attribute data-value = "10"
.
Does there is anyway to get and update the data-value
value?
Answer
1 | <div id="mydiv" data-value="10"></div> |
1 | var a = $('#mydiv').data('myval'); //getter |
Reference
This is the end of post