I have a div with an attribute data-myval = "10"
. I want to update its value; wouldn’t it change if I use div.data('myval',20)
? Do I need to use div.attr('data-myval','20')
only?
Am I getting confused between HTML5 and jQuery? Please advise. Thanks!
EDIT: Updated div.data('myval')=20
to div.data('myval',20)
, but still the HTML is not updating.