Recently I was coding away, and I ran into a weird issue. I was attempting to assign a data attribute to a new element I had created (via jQuery), only to discover it would
jQuery imports the data- attributes when the element is loaded, but does not access it afterwards. The elements are stored in a jQuery internal structure. From the API:
The
data-attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).