The jQuery attribute set does not agree with the attribute as set by native js and apparently they exist differently and simultaneously. Can anyone tell me what is going on?
$(document).ready(function() {
document.getElementById('attributed').setAttribute('data-foo','mydiv2');
$('#attributed').data('foo','mydiv4');
// jQuery thinks it's mydiv 4
alert($('#attributed').data('foo'));
// native thinks it's mydiv 2!
alert(document.getElementById('attributed').getAttribute('data-foo'));
});