SyntaxFix
Write A Post
Hire A Developer
Questions
Use the .data() method:
.data()
$('div').data('info', '222');
Note that this doesn't create an actual data-info attribute. If you need to create the attribute, use .attr():
data-info
.attr()
$('div').attr('data-info', '222');