Remember.js is a lightweight but flexible javascript library to help you save user settings and data between sessions.

It was born out of an upcoming news reader project where I found myself continuously hassled by errors and incompatibilities when saving user settings on the client-side. I decided it was time to create a library that did everything I needed and more. So here you have it, remember.js

Usage

· via HTML

To remember an elements value, simply add the data-remember attribute

For example:

<input type='text' data-remember>
<input type='checkbox' data-remember>
<select data-remember>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
<select>

· via Javascript

To remember a value using javascript, you should call

var myElement = document.getElementById("#myElement");
new remember.Control(myElement, options);

with the arguments:

Once all the elements are registered, use

remember.save();
remember.load();
remember.reset();

to save, load and reset the elements values respectively.

For examples of correct usage and some extra features, check out the Demo page.

Download

To use remember.js, include the following file just before your closing body tag

remember.js
12.4 KB
remember.min.js
4.5 KB
Note: To support IE7 and below you must also include json2.js

Contribute

View the project on Github. Feel free to fork or contribute!