Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

Metadata


Average rating
(13 votes)

This plugin is capable of extracting metadata from classes, random attributes, child elements and HTML5 data-* attributes.

For example, you can do:

<li class="someclass {some: 'data'} anotherclass">...</li>
OR
<li data="{some:'random', json: 'data'}">...</li>
OR
<li><script type="data">{some:"json",data:true}</script> ...</li>
OR
<li data-some="'random'" data-json="'data'">...</li>

The default is the first method, but you can always change it by twiddling the options. This means that there is at least one option here that can appease you.

After that you can simply do:

var data = $('li.someclass').metadata();
if ( data.some && data.some == 'data' )
    alert('It Worked!');

There's also a bunch of options (like the ability to ignore braces {}).

For full documentation see http://docs.jquery.com/Plugins/Metadata.

Releases

Official releasesDateSizeLinksStatus
1.02007-Oct-1534.13 KBRecommended for 1.1.xThis is currently the recommended release for 1.1.x.
2.02007-Oct-1534.35 KBRecommended for 1.2.xThis is currently the recommended release for 1.2.x.
2.12009-Jun-2336.48 KBRecommended for 1.3.xThis is currently the recommended release for 1.3.x.