jQuery Data - removeData() Method

Example

Remove previously added data from the element:

$("#btn2").click(function(){
  $("div").removeData("greeting");
  alert("Greeting is: " + $("div").data("greeting"));
});

Try It Yourself

Definition and Usage

removeData() method removes data previously set using the data() method.

Syntax

$(selector).removeData(name)
Parameter Description
name

Optional. Specifies the name of the data to be removed.

If no name is specified, the method will remove all stored data from the selected element.