Using jQuery 1.7.2, how do I update the data-*
attrs in my elements when the data model is updated?
For example:
$('el').attr('data-x', 400);
var data = $('el').data( );
data.x += 100;
Changing the $(el).data()
does not seem to push the changes back to the elements' data-*
attrs.
Why would I want this? I would like to use the built in jQuery selectors with up-to-date data .