I have an weird issue with jquery data function. Here is the fiddle
As you can see I update the active
data but I cannot see the dom data-active
attribute value change, although I re-query the active data, It writes the changed value.
$.data() do not update the attribute on the dom when I inspect it.
jQuery data
api does not depends on the element attribute although it uses data-<key>
to fetch the initial value if it is available.
jQuery uses an internal javascript object to maintain the data value of objects
If you want to update the attribute
then you will have to use .attr('data-<key>', '<value>')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With