Autosave is designed to save the progress of forms by saving the fields to cookies so you won't lose anything should anything go wrong
The plug-in saves the form fields at certain intervals (the default is every 10 seconds) and whenever you leave the page.
The plug-in was written with work-intensive forms in mind, such as a blog article writing form.
To try this example, fill in some of the form fields and leave the page – clicking here will do. When you come back, your precious work will have been lost as the form fields will be blank, but you can click the "Restore form" button to magically rescue your work.
Delete related cookies Saving...
The example uses following code:
$('form *').autosave();
$(form_fields).autosave(options);
As the plug-in will only work on certain elements, you can select all elements and the plug-in will still work, e.g. $('form#the_form *').autosave();
By default, the class for saving the form is "autosave", the restore class is "autosave_restore" and the remove all related cookies class is "autosave_removecookies". So if you attach the class "autosave" to any link or button, it will save automatically.
The "Saving" notifier will show on any "autosave_saving" class
The plug-in requires Klaus Hartl's jQuery Cookie plug-in to work.
Here's an example of how to use options:
$('textarea').autosave({
'interval': 20000,
'unique': 'articleadd'
});
And here are the options:
The plug-in requires Klaus Hartl's jQuery Cookie plug-in to work.