A autoSave jQuery Plugin
-
Include necessary JS files
<script src="jquery.js"></script> <script src="jquery.autoSave.min.js"></script>
-
(Optional) Add autoSave CSS file. Please tweak it to serve your needs.
<link rel="stylesheet" href="style.css" />
-
Create the following HTML element
<textarea id="text"></textarea> <span id="msg"></span>
-
Fire plugin using jQuery selector
$(function() { $("#tabs").autoSave(callback, ms); });
ms allows to delay callback function. default value is 2 seconds.
-
Example
$("#text").autoSave(function() { var time = new Date().getTime(); $("#msg").text("Draft Autosaved " + time); }, 500);
-
Have fun:-)
- IE8 and above, Firefox, Chrome, Safari and Opera
Released under the MIT license.