jQuery Plugin To Preserve Form Data Using Local Storage - Ftakar

File Size: 41.3 KB
Views Total: 1357
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Preserve Form Data Using Local Storage - Ftakar

Ftakar is a jQuery plugin that detects if the fields of a form had been modified and save the form values into local storage for preventing data loss.

See also:

How to use it:

1. Load the jQuery ftakar plugin after jQuery library.

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="js/ftakar.js"></script>

2. Attach the plugin to the form elements and adjust the settings as required.

$('input, select').not('input[type="submit"]').ftakar();

3. Default plugin settings.

savedDataName: 'FTAKAR',

// save every n ms
saveOnInterval: false,

// save when element has changed
saveOnChange: true,

// clern saved data on submit
clearOnSubmit: true,

// ms to save data for element
expireInMs: false,

// priority by order of attribute
idAttribs: ['id', 'name', 'data-ftakar'],

// function called before save of every element 
beforeSave: function(){ console.info('FTAKAR: data is being saved', $(this)) },

Change log:

2015-05-06

  • fixed id bug

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