Persist Form Data Using HTML5 Local/Session Storage - Persist.js

File Size: 4.69 KB
Views Total: 3335
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Persist Form Data Using HTML5 Local/Session Storage - Persist.js

Persist.js is a lightweight jQuery plugin that saves data from an HTML form with HTML5 local storage (or session storage) and restores the form to it's previous state when needed.

The plugin can be used to prevent data loss in your HTML form when the webpage is accidentally closed, reloaded or navigated away.

Supports any form fields such as text field, select box, checkbox, radio button and more.

How to use it:

1. Import jQuery JavaScript library and the jQuery Persist.js plugin into the document.

<script src="" 
<script src="jquery-persist.js"></script>

2. Call the function on your form fields and done.




3. Set the context or namespace for each field.

  context : 'def'

4. Set the variable basename.

  basename : 'jqpersist'

5. Whether or not to replace existing field contents if any.

  replace : true

6. Whether or not to use Session Storage instead of Local Storage

  session : false

This awesome jQuery plugin is developed by commonpike. For more Advanced Usages, please check the demo page or visit the official website.