Say,
<a id="link-one" href="#" data-status="true">Anchor</a>
The following code writes "true" on the console:
console.log($('#link-one').data('status'));
And, when I change the value like this:
$('#link-one').attr('data-status', 'false');
the value changes, and I can see that by inspecting the element with Chrome inspector. Yes, it really is changing.
However, after assigning/changing the value like above and then accessing it again after changes returning me the initial value, not the modified new value. I need to access the current value, that is after changes.
console.log($('#link-one').data('status')); // writes "true"
$('#link-one').attr('data-status', 'false');
console.log($('#link-one').data('status')); // writes "true" again
Am I missing something? Or this is default behavior of jQuery (if yes, how can I achieve what I need)?