I’m having trouble with jQuery element.data() resetting mysteriously. I’ve checked that the data is stored ok to the element on a click event.
Some simple tests to recreate the problem (with no success) here.
What happens after the data-storing is a series of actions, changing id:s for the data-fields, form submit, handling of the response, some rendering etc… In short, enough things that it’s slow to find the problem. I’ve checked the $.cache-object which doesn’t have the data I stored. The .removeData’s in the code all target the submit-button in the form where I edit the input-fields.
$element.removeData('attribute');
Any ideas what things can cause the data to reset?
jQuery.data source here
Have you changed your html templates?
I recently dealt with the same problem where data was disappearing on a click event. I had re-templated my html and was attaching the data on a parent node, but the click event was firing on a child node.