Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hubgit/jquery-microdata
jQuery plugin for HTML Microdata
https://github.com/hubgit/jquery-microdata
html-microdata jquery jquery-plugin microdata
Last synced: about 1 month ago
JSON representation
jQuery plugin for HTML Microdata
- Host: GitHub
- URL: https://github.com/hubgit/jquery-microdata
- Owner: hubgit
- License: mit
- Created: 2014-01-02T17:03:28.000Z (almost 11 years ago)
- Default Branch: gh-pages
- Last Pushed: 2014-06-11T10:25:05.000Z (over 10 years ago)
- Last Synced: 2023-04-12T23:27:19.324Z (over 1 year ago)
- Topics: html-microdata, jquery, jquery-plugin, microdata
- Language: JavaScript
- Homepage: http://git.macropus.org/jquery-microdata/jquery.microdata.js
- Size: 566 KB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# jQuery Microdata
Extract and manipulate objects stored in [HTML Microdata](http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html).
[Demonstration](http://git.macropus.org/jquery-microdata/demo/)
### Get all items of a certain type
$(node).items(itemtype)
$('#albumlist').items('http://schema.org/MusicAlbum')
### Get the property nodes of an item
item.property(property) => a set of jQuery nodes
$(node).property('name') => [ node ]
$(node).property('byArtist').eq(0).property('album') => [ node, node ]
### Get the value of a property
property.value() => the itemValue of the node(s)
$(node).property('name').value() => string
$(node).property('byArtist').eq(0).property('name').value() => string
### Get the values of a property as an array
property.values() => array of the itemValues of the nodes
$(node).property('name').values() => [ string, string ]
### Set a property
item.property(property).value(value)
$(node).property('name').value('Yellow Submarine')
### Set one of multiple properties with the same name
item.property(property).eq(index).value(value)
$(node).property('name').eq(1).value('Yellow Submarine')
## jQuery ThingsThe plugin also provides a convenience method for working with items ("things") where there is only a single instance of each property. This is analogous to [jQuery's `data` method](http://api.jquery.com/data/).
### Get a property of an item
item.microdata(key)
$(node).microdata('name');
### Set a property of an item
item.microdata(key, value)
$(node).microdata('name', 'The Beatles');
### Set multiple properties of an item
item.microdata({ key: value })
$(node).microdata({
name: 'The Beatles',
url: 'https://en.wikipedia.org/wiki/The_Beatles'
});### Get all properties of a single item or a collection of matched items
collection.microdata()
$(node).microdata()
$('#albumlist').items('http://schema.org/MusicAlbum').microdata()