Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

Values


Makes it trivial to get/set values for any DOM element(s) very intelligently and extensibly. Simply add "name" attribute(s) (as you do for form elements) to the elements whose values you wish to retrieve or set and call values() on a selection to retrieve those keys/values in a handy little hash object.

To get all values:
var values = $('form').values();
To set values:
$('#demo').values({ foo: 'bar', answer: 42 });
To get one value:
var foo = $('.bar').values('foo');
To set one value:
$('.bar').values('foo', 'bar');

Another way to think of this is as using your markup as a bi-directional template that needs no extra syntax. Rather than replacing special placeholders, it uses element attributes to identify where values should be set or retrieved. This allows the data binding to work in both directions and does not require separate template files, you can work directly on your markup.

For more details on all available functions and configuration options, see the comments in the source.

Downloads



4.333335
Your rating: None Average: 4.3 (3 votes)