If you are doing something crazy, for example, using the data attribute to apply a style (no, it's not very crazy), you need both jQuery cache and DOM to update.
Change jQuery
$element.data(key, value);
which will not update the DOM to a method that executes as
var data = function($element, key, value) { $element.data(key, value); $element.attr('data-'+key, value); } data($element, key, value);
Note. I always put $ in front of jQuery variables if someone is confused.;)
DanielM
source share