$('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
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…