Get data-attribute jquery vs javascript -
i have custom data-attribute set default:
data-equipment="0"
if change jquery using .data()
$(this).data("equipment", 10)
and use getattribute()
this.getattribute("data-equipment")
i old value (0) , not new 1 (10). if use
$(this).data("equipment")
new value (10).
is supposed work or missing something?
thanks!
.data()
doesn't operate on data attributes in internal jquery cache. if no cache record found, data read corresponding data-
attribute if 1 exists, end of co-operation.
if operated on attributes, useless purpose because attribute values must strings.
Comments
Post a Comment