- Overview
- Documents
autoStorage is a jQuery plugin for automatic webstorage that makes to save the values of the form in the specified webstorage by submitting the form and reloaded by reloading the page.
Source: github.com
Jul 14, 2014 in Forms 3363 views
autoStorage is a jQuery plugin for automatic webstorage that makes to save the values of the form in the specified webstorage by submitting the form and reloaded by reloading the page.
Source: github.com
1. INCLUDE JS FILES
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="autoStorage.js"></script>
2. HTML
<form name="form1"> <h1>autoStorage Example</h1> <div class="form-group"> <label for="exampleUsername1">Username</label> <input type="text" name="exampleUsername1" class="form-control" id="exampleUsername1" placeholder="Username"> </div> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" name="exampleInputEmail1" class="form-control" id="exampleInputEmail1" placeholder="Enter email"> </div> <div class="checkbox"> <label> <input type="checkbox" name="exampleCheckbox1"> Check me out </label> </div> <button type="submit" class="btn btn-default">Submit</button> </form>
3. JAVASCRIPT
$( function() { $('form').autoStorage( { 'submit' : true, 'storageType' : 'local' }); });
4. OPTIONS
"storageType" : "local" | "session"
Define the type of storage. At the moment there is no support for sqlite (As it is absolutely useless due a lack of support by most browsers). The default is "local". If you are new to the webstorage feature: "localStorage" keeps the data like forever while "sessionStorage" is a temporary storage, that will be deleted after you quit your browser.
"exclude" : ["element1", "element2" ... ]
Pass an array with element names to exclude from storage.
"submit" : true | false
Defines wether the form will be submitted. Set this to false, for ajax like forms.
Tagged with:
autostorage
automatic webstorage
jquery plugin
forms
form save
webstorage
reloading
submitting the form
Related Articles