Download
User Rating: 0/5 ( 0 votes)
Formsaver.js is a easy jQuery plugin for saving and restoring form data into LocalStorage.
Requirements:
-
jQuery 1.0+
-
LocalStorage support (IE 8.0+, Firefox 3.5+, Safari 4.0+, Chrome 4.0+, Opera 10.5+, iOS Safari 2.0+, Android 2.0+)
-
JSON support (IE 8.0+, Firefox 3.1+, Safari 4.0+, Chrome 3.0+, Opera 10.5+, iOS Safari 4.0+, Android 2.1+) or JSON.js library
Source: hackprime.github.io
1. INCLUDE JS FILES
<script type="text/javascript" src="javascripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="javascripts/jquery.formsaver.js"></script>
2. HTML
<form id="testform">
<div class="field">
<label class="label" for="id_text_input">Text input</label>
<input class="field__text" type="text" name="text_input" id="id_text_input">
</div>
<div class="controls">
<button class="control_save">Save</button>
<button class="control_reset" type="reset">Reset</button>
<button class="control_restore">Restore</button>
</div>
<div id="message"></div>
</form>
3. JAVASCRIPT
$(".control_save").click(function () {
$("#testform").saveForm();
return false;
});
$(".control_restore").click(function () {
$("#testform").restoreForm();
return false;
});