How can I avoid conflicts with other jQuery plugins using $.data()?
I was thinking I could use a single key to store my data like
$(el).data('myplugin', { foo: 'a', xyz: 34});
and access it like $(el).data('myplugin').foo etc.
But how can easily change a value, without overriding the whole data? Like changing the value of “foo”.
Why not using
and
?
So if you don’t need to access more than one value at the same time, you avoid useless indirections and tests.