Using jQuery's datastore vs. expando properties

后端 未结 4 1737
我在风中等你
我在风中等你 2021-01-31 20:22

I\'m developing code using jQuery and need to store data associated with certain DOM elements. There are a bunch of other questions about how to store arbitrary data w

4条回答
  •  被撕碎了的回忆
    2021-01-31 21:04

    Using $.data doesn't modify the DOM. You should use $.data. If you're creating a plugin then you should store one object in $.data with properties on that object as opposed to storing each of those properties as different key/value pairs in the $.data structure.

提交回复
热议问题