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
Jquery data also gets removed from an element when the element gets removed from the DOM. You can still access the deleted element inside a mutation observer, but the Jquery data on it is gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With