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.
Second: Please give problem code and a description of what is going wrong. The post is almost as vague as "I have a problem with css, how do I fix it?" which tells us almost nothing.
Third: Welcome to web programming. When I started in 2000, no browser complied to the standard. Fast forward 13 years, and still we have variances even if things are vastly better now.
I suggest you read the post at the top of the forum, it gives guidance about how to ask a question.