.removeData( [name ] )Возвращает: jQuery
Описание: Удаляет пользовательские переменные, установленные методом .data() у выбранных элементов страницы.
-
Добавлен в версии: 1.2.3.removeData( [name ] )
-
nameТип: StringA string naming the piece of data to delete.
-
-
Добавлен в версии: 1.7.removeData( [list ] )
-
listAn array or space-separated string naming the pieces of data to delete.
-
The .removeData()
method allows us to remove values that were previously set using .data()
. When called with the name of a key, .removeData()
deletes that particular value. When called with no arguments, .removeData()
removes all values.
Note that .removeData()
will only remove data from jQuery's internal .data()
cache, and any corresponding data-
attributes on the element will not be removed. A later call to data()
will therefore re-retrieve the value from the data-
attribute. To prevent this, use .removeAttr()
alongside .removeData()
to remove the data-
attribute as well. Prior to jQuery 1.4.3,
as data()
did not use data-
attributes, this was not an issue.
As of jQuery 1.7, when called with an array of keys or a string of space-separated keys, .removeData()
deletes the value of each key in that array or string.