jQuery Misc Phương thức removeData ()

❮ Phương thức jQuery Misc

Thí dụ

Xóa dữ liệu đã đính kèm trước đó khỏi phần tử <div>:

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

Định nghĩa và Cách sử dụng

Phương thức removeData () loại bỏ dữ liệu đã đặt trước đó với phương thức data () .


Cú pháp

$(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

❮ Phương thức jQuery Misc