an ultra-light jQuery plugin that automatically saves form values in the client side (using HTML5 localStorage) and restore them on your next visit. A great solution to prevent data loss in case the browser is refreshed or the page is suddenly closed.
Include jquery and Savy JS files
<script src="https://github.com/medabida/savy/raw/master/jquery.js"></script>
<script src="https://github.com/medabida/savy/raw/master/savy.min.js"></script>
Create the following HTML element (each element must have a unique ID)
<form action="foo.php">
First name:<br>
<input id="fname" type="text" class="auto-save" name="firstname" value="Mickey">
<br>
Last name:<br>
<input id="lname" type="text" class="auto-save" name="lastname" value="Mouse">
</form>
initialize Savy
$('.auto-save').savy('load');
// you can pass a function to be called when savy is finished loading.
$('.auto-save').savy('load',function(){
console.log("All data from savy are loaded");
});
destroy Savy
$('.auto-save').savy('destroy');
// you can pass a function to be called when savy is destroyed.
$('.auto-save').savy('destroy',function(){
console.log("All data from savy are destroyed");
});
Released under the MIT license