Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rjz/jquery-domdatasource

Did you say bootstrap? A little jQuery magic turns the DOM into a rich data source.
https://github.com/rjz/jquery-domdatasource

Last synced: 17 days ago
JSON representation

Did you say bootstrap? A little jQuery magic turns the DOM into a rich data source.

Awesome Lists containing this project

README

        

jQuery.DOMDataSource
====================

Just a simple interface for getting data from the DOM into Javascript.

Usage
-----

To retrieve semantic data stored in the DOM, pass a hash of accepted attributes to `$.DOMDataSource`:


yellow
dodge
dart

jQuery(document).ready(function ($) {

var attributes = {
color: '',
make: '',
model: ''
};

var car = $('.car').DOMDataSource(attributes);
});

Collections of data can also be retrieved from lists:



  • blue
    amc
    hornet


  • orange
    chevrolet
    corvair

// in script:
var cars = $('ul').DOMDataSource(attributes);

Finally, data may also be sourced from tables. Note that tables will try and convert the column headers into attribute keys.




Color
Make
Model




green
oldsmobile
woodie


silver
dmc
delorean


// in script:
var cars = $('table').DOMDataSource(attributes);

Author
------

RJ Zaworski

License
-------

The jquery.DOMDataSource plugin is released under the WTFPL License. You can read the license [here](http://sam.zoy.org/wtfpl/).