Adding data attribute to DOM
$(‘div’).data(‘info’, 1); alert($(‘div’).data(‘info’)); //this works $(‘div[data-info=”1″]’).text(‘222′); //but this don’t work I’m creating element within jquery. After that, I want to add attribute “data”. He’s like and is added, but in the DOM, this is not apparent, and I can’t get the item, using $(‘div[data-example=”example”]’).html() jsfiddle 6 Answers 6