jQuery.removeData(element [, name]) (alias $.removeData) deletes values previously set with jQuery.data() from a DOM element (since jQuery 1.2.3). With a name, one key is removed; without a name, the whole store for that element is cleared.
Remember
$.removeData(element, name) → delete one key
$.removeData(element) → clear all keys
$.data(el, "test1", "VALUE-1");
$.removeData(el, "test1");
$.data(el, "test1"); // undefined
// Returns undefined — not chainable
No name.$.removeData(el) clears every cached value for that node.
Reads fail. Both keys return undefined afterward.
When to use. Handy before re-init when you want a clean slate.
Example 3 — Cache Cleared, data-* Remains
Removing cache does not delete the HTML attribute.
jQuery
// <div id="x" data-score="10"></div>
var el = $("#x")[0];
$("#x").data("score"); // 10 (from attribute into cache)
$.removeData(el, "score");
console.log($("#x").attr("data-score")); // "10" — still there
console.log($("#x").data("score")); // may become 10 again from attr
Init.counter stores options on each matched element via $.data.
Destroy.counterDestroy calls $.removeData(this, "counter") per element.
Natural fit. Inside .each, this is already a DOM element.
Result. The key is gone — the host is ready for a fresh init.
Edge Cases & Pitfalls
Check these before relying on $.removeData() in real projects.
types
Pass a DOM element, not a jQuery object
Use $el[0] or $el.get(0). Passing the collection as element is incorrect for this static API.
attr
data-* attributes are not removed
Only the internal cache is cleared. Pair with .removeAttr("data-…") when markup must change too.
chain
Return value is undefined
You cannot chain off $.removeData(). Use .removeData() when you need chaining.
lists
Multi-key lists are an instance feature
Since jQuery 1.7, .removeData(["a","b"]) or space-separated names work on collections. The static signature takes a single optional name string.
Compatibility
Browser Support
jQuery.removeData() needs a browser DOM. It has been available since jQuery 1.2.3+ in all browsers your jQuery build supports — it is not for Node.js, Bun, or Deno without a DOM.
✓ jQuery 1.2.3+ · Browsers only
jQuery.removeData()
Works in Chrome, Firefox, Safari, Edge, and other browsers with jQuery loaded. Prefer .removeData() on collections for everyday code.
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
$.removeData()Browsers
Bottom line: Use $.removeData(element [, name]) in the browser with a DOM element. Prefer .removeData() when chaining.
Analysis
Performance Notes
Approach
Cost
Best for
$.removeData(el, key)
O(1)
Delete one known key on a raw node
$.removeData(el)
O(keys)
Full cleanup before re-init
$(el).removeData(key)
O(n × keys)
Collections / chaining
Removal is cheap compared with DOM work. Prefer named deletes when you only need one key; clear all when the element is being reset or destroyed.
Remember
Key Takeaways
Role:$.removeData(el [, name]) clears the jQuery data cache.
Args: DOM element required; name optional.
Prefer:.removeData() for everyday / chaining.
Attrs:data-* stay unless you also removeAttr.
One line:$.removeData(element [, name]) deletes cache keys on a raw DOM node — prefer .removeData() when chaining, and remove data-* separately if needed.
Frequently Asked Questions
jQuery.removeData(element [, name]) deletes previously stored jQuery data from a DOM element. With a name, only that key is removed. With no name, all values for that element are removed. It returns undefined. Added in jQuery 1.2.3.
Same cache, different call shape. jQuery.removeData(el, key) takes a raw DOM element and is not chainable. .removeData() is called on a jQuery collection, is chainable, and (since 1.7) can take an array or space-separated list of keys. Official docs recommend .removeData() for everyday code.
No. It only clears jQuery’s internal cache. Attributes like data-test1 stay in the markup. A later $(el).data("test1") may re-read the attribute into the cache. Use .removeAttr("data-test1") as well when you need the attribute gone.
jQuery.removeData(element) with no name clears the entire data store for that element (all keys set with jQuery.data / .data that live in the cache).
The API returns undefined. Unlike .removeData(), you cannot chain further jQuery methods off the static call.
When you already hold a raw DOM node (for example div = $("div")[0]) or are following official utility demos that pair jQuery.data with jQuery.removeData. New UI code should prefer .removeData() on a collection.