jQueryその他removeData()メソッド

❮jQueryその他のメソッド

以前に添付されたデータを<div>要素から削除します。

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

定義と使用法

removeData()メソッドは、data()メソッドで以前に設定されたデータを削除します。


構文

$(selector).removeData(name)

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

❮jQueryその他のメソッド