jQuery metadata, how to get the value? -


i'm having tough time getting value of key in data attribute. i'm using jquery metadata plugin.

jquery:

jquery.metadata.settype("attr", "data");  $('ul li').each(function () {      console.log($(this).metadata()) }); 

html

<ul>    <li data="{somekey:'somevalue',anotherkey:'anothervalue'}">some list item</li>    <li data="{somekey:'somevalue2',anotherkey:'anothervalue2'}">some list item 2</li>    <li data="{somekey:'somevalue3',anotherkey:'anothervalue3'}">some list item 3</li> </ul> 

i outputting object, have no idea how @ value. i've tried $(this).metadata().somekey , $(this).metadata('somekey') , grasping straws.

alt text

looks want this:

mymeta = $(this).metadata(); 

then can access mymeta.somekey or mymeta.anotherkey - whatever meta keys have set.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -