Documentation

Plugins/Metadata/jQuery.metadata.setType

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Plugins/Metadata

jQuery.metadata.setType( type, name )

Sets the default type and name options for all following metadata requests.
Arguments:
typeString
Specify the expected location of metadata for the element. Possible values are 'class' (default): search in the class attribute, 'elem': search for an element inside the element being searched, and 'attr': search in a custom attribute on the element.
nameString
The name of the tag or attribute for which to search depending on the value of the 'type' option.


Examples:

Setup metadata plugin to look for a custom attribute.

<li data="{some:'random', json: 'data'}" class="someclass">...</li>

<script>
$.metadata.setType('attr','data');
alert($('li.someclass').metadata().some);
</script>

NameType