.removeData([name|list]) deletes values previously stored with .data() from jQuery’s internal cache (since 1.2.3; bulk keys since 1.7). With no arguments, it clears all cached values.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$div.data("test1", "VALUE-1")
$div.removeData("test1") // one key
$div.removeData(["a", "b"]) // bulk (1.7+)
$div.removeData("a b") // space-separated (1.7+)
$div.removeData() // clear all
// HTML data-* attributes are NOT removed
Call
What it does
removeData()
Learn jQuery .removeData(): delete values from jQuery's data cache, one key or all, bulk keys since 1.7, data-* pitfalls, examples, and FAQs.
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Select the element(s) that hold jQuery data.
Step 2
Pass one key, a list of keys (1.7+), or nothing to clear all.
Step 3
Call .removeData(…) — the element stays in the DOM.
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
Value / undefined
Getters usually return a value from the first matched element, or undefined when nothing applies.
jQuery Examples
Example 1 — Official Demo: Remove One Key
Store two values, delete test1, confirm test2 remains.
.removeData(name) deletes one value from jQuery's internal data cache on matched elements. With no arguments, it clears all cached values. Returns the jQuery collection for chaining. Available since jQuery 1.2.3.
.data() stores values; .removeData() deletes them from the same cache. Use .data() for plugin state and .removeData() when resetting or destroying a widget.
No. It only clears jQuery's internal cache. data-* attributes stay in the DOM, so a later .data('key') may re-read data-key. Pair with .removeAttr('data-key') when you need both gone.
Yes, since jQuery 1.7. Pass an array — .removeData(['foo', 'bar']) — or a space-separated string — .removeData('foo bar').
.removeData() clears cached values but keeps the element. .remove() deletes the element from the DOM and also cleans up its data and events.
When resetting widget state, clearing stale options, or cleaning up before re-init on the same element. Elements removed with .remove() already lose their cache; detached nodes keep it until you clear it.