The jQuery data api is independent of the attribute of the element, although it uses data-<key> to retrieve the initial value, if available.
jQuery uses an internal javascript object to store the value of these objects
If you want to update the attribute , you will need to use .attr('data-<key>', '<value>')
source share