Check if jquery metadata exists? -
No information was found about this googling. Hope this does not mean that you can not do this I am trying to check if metadata exists on any element. So if I have & lt; A href = "#" class = "myclass {myid: 2, text: bla}" & gt;
As an element, I use $ (this) with my click function .hasClass ('myid') or
$ (this) .hasClass ({ Myid '})
. Is it possible to do this?
Can you add metadata dynamically? If I try $ (this) .addClass ({some: data}), then it adds it to the class, but I can not read it with metadata ().
It looks like you
, You can store and retrieve data in such a way by using any element. $ ($ # SomeID) element on / p>
// store value. Data ('secret', 'My voice is my password, verify me.'); $ ('# SomeID') data ('era', 33). $ ('Name', 'Jasper') to $ ('# SomeID') $ ('#in some AID') Data ('business', 'toy maker'); Get value from the element alert ('Hi my name is' + $ ('# someID'). Data ('name') + 'I' '$' ('# someID'). Data ('age') + 'I' '$ (' # some AID '). Data (' business') + 'oh, and' $ ('# some aid'). Data ('secret'));
Comments
Post a Comment