Feel free to submit any suggestions/issues and contribute.
Watch our demo
Download asdfasdf.min.js
asdfasdf depends on jQuery and jQuery.cookie. Just add them if your are not using them and init calling asdfasdf.js (is not needed to wait until the DOM is ready)
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/asdfasdf.min.js"></script>
<script type="text/javascript" >
asdfasdf();
</script>
Or include it from a CDN:
<script type="text/javascript" src="https://cdn.rawgit.com/jupegarnica/asdfasdf.js/gh-pages/asdfasdf.min.js"></script>
asdfasdf is totally configurable passing a setting object when called.
asdfasdf({elements:'input.autosave'});
The default setting is:
var defaultsetting = {
//show feedback when autosave data
showFeedback: true,
//show feedback when autoload data
showLoaded: true,
// feedback message properties
msgLoadDataText: "Data Loaded",
msgStyle: "position: fixed;top: 2em;color: white;background: tomato;right: 50%;transform: translateX(50%);width: auto;display: inline-block;padding: 0.5em;border-radius: 0.3em;text-transform: uppercase;",
msgText: "auto saved",
msgHide: 500,
//Elements to be saved
elements: 'input, textarea, select',
//Time to keep the data
expires: 2,
}
- Autosave for all kind of inputs: RADIO, CHECKBOX, TEXT, TEXTAREA, SELECT
- Auto load when the user return to the form.
- Save codificated data on cookies for privacity.
- Feedback when saving and loading data.
- Ultra Fast! just 4k
- Want more? buy a Swiss Army knife
Not needed :D
The MIT License (MIT)
Copyright (c) 2015 jupegarnica [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Made by jupegarnica.com