Remove multiple html5 data-attributes with jquery

后端 未结 7 1132
清酒与你
清酒与你 2020-12-16 14:25

So jquery api says the following:

Removing data from jQuery\'s internal .data() cache does not effect any HTML5 data- attributes in a document; use .

7条回答
  •  一整个雨季
    2020-12-16 14:48

    use the jQuery method removeData()

    jQuery site states:

    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.

    The key part here is:

    When called with no arguments, .removeData() removes all values.

    https://api.jquery.com/removeData/

提交回复
热议问题