I am trying to set a data attribute to a div which previously doesn't have any value.
<div></div>
with jQuery, the first method (data) doesn't do anything, however the attr method works correctly.
var div = $('div');
div.data('superhero_one','batman');
div.attr('data-superhero_two','spiderman');
Am I using incorrectly the data function?