Remove a previously-stored piece of data.

jQuery.removeData(element, name)🡢 undefined

element ElementA DOM element from which to remove data.
name StringA string naming the piece of data to remove.

Note: This is a low-level method, you should probably use .removeData() instead.

The jQuery.removeData() method allows us to remove values that were previously set using jQuery.data(). When called with the name of a key, jQuery.removeData() deletes that particular value; when called with no arguments, all values are removed.

Set a data store for 2 names then remove one of them.

<div>value1 before creation: <span></span></div>
<div>value1 after creation: <span></span></div>
<div>value1 after removal: <span></span></div>
<div>value2 after removal: <span></span></div>
div {
  margin: 2px;
  color: blue;
span {
  color: red;
var div = $("div")[0];
  .text("" + $("div").data("test1"));
jQuery.data(div, "test1", "VALUE-1");
jQuery.data(div, "test2", "VALUE-2");
  .text("" + jQuery.data(div, "test1"));
jQuery.removeData(div, "test1");
  .text("" + jQuery.data(div, "test1"));
  .text("" + jQuery.data(div, "test2"));

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)