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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -