I am trying to set attribute for a Html label I am setting its value by jQuery on every change but when I try to get attribute value it return value first value that was assign to this attribute. Here are some code chunks for better understanding
<label class="" id="totalShortHours" name="totalShortHours">0</label>
On every change in time field it change attribute value that I can check in Developer tools element
But When I try to get value it return garbage
Using document.getElementById('totalShortHours').dataset.hours will resolve your issue.
document.getElementById('totalShortHours').dataset.hours
1.4m articles
1.4m replys
5 comments
57.0k users