Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Misc removeData() Method

jQuery Misc removeData() Method

jQuery Miscellaneous Methods jQuery Miscellaneous Methods

Example

From the

Remove previously attached data from an element:

$("#btn2").click(function(){

$("div").removeData("greeting");

alert("Greeting is: " + $("div").data("greeting"));

});

Try it »


Definition and Usage

The removeData() method removes data previously set by the data() method.


Syntax

$(

selector

).removeData(

name

)

Parameters Description
name Optional. Specifies the name of the data to be removed.
If no name is specified, this method will remove all stored data from the selected elements.

jQuery Miscellaneous Methods jQuery Miscellaneous Methods