I've run into a rather interesting, and frustrating bug that I'm hoping someone has some experience with or can help me work around.
Here's the scenario, and I've also set up a fiddle to show it [^]
I have a div with data-location="1"
If I move this div like this
and then change the data-location value
I can no longer find the element using the data-location attribute.
This returns 0
This returns 1
BUT, this returns newValue
Has anyone ever run into this? Am I missing something here, or doing something wrong?
[EDIT: has some trouble with the fiddle, the link works now.]
Apparently the .data in jquery only reads the attributes once and never sets the attributes. If you want to set data- attributes and recall them in your code you have to use the .attr() call.
modified 28-Dec-12 10:51am.
Last Visit: 31-Dec-99 19:00 Last Update: 3-Mar-15 22:14