Keep inputs, selects, textareas data, even if web page is refreshed.
Include keep.js
to your html file
<script type="text/javascript" src="path/to/keep.js"></script>
Add keep
attribute to the inputs like bellow
<label for="name">
Enter your name
<input type="text" name="name" id="name" value="" keep>
</label>
and initialize plugin via Javascript like this
keep()
KeepJS will scan for inputs that have keep
in their attributes and will watch data changes.
We can also do it only in JS keep([HTMLElement1_ID, HTMLElement2_ID, HTMLElement3_ID, ...HTMLElements_ID])
Strings in array are IDs of the inputs.
keep([
'birthday',
'full_name',
'gender',
'description',
'job',
'favorite_color'
])
In this version (1.0.0) of plugin, only one option is available.
Add keep-lazy
to the tag or in JS
By default, this option is set to true.
keep({
targets: [ 'birthday', 'full_name', 'gender', 'description', 'job', 'favorite_color' ],
opts: {
lazy: Boolean
}
})
If lazy is falsy, data will be kept on keyup of the inputs.
This option will be available soon. By default, this option is set to false. You'll be able to keep more than one value for an tag and choose one when serving data.
Add keep-multiple
to the tag or in JS
keep({
targets: [ 'birthday', 'full_name', 'gender', 'description', 'job', 'favorite_color' ],
opts: {
lazy: Boolean,
multiple: Boolean
}
})
NOT AVAILABLE IN V-1.0.0
Jean-jacques AKAKPO (akakpo.jeanjacques@gmail.com)
An ovaar products