-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
183 lines (157 loc) · 5.51 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Input Store Example</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="inputStore.jquery.min.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-53648946-13"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-53648946-13');
</script>
</head>
<body style="padding: 1em">
<h1> Input Store jQuery Plugin </h1>
<p> A jQuery plugin that allows you to define cookie-stored input fields so that a user's previous information is stored upon input. </p>
<hr>
<div class="gettingStarted">
<h3> Getting Started </h3>
<div>
<ol>
<li> You can download the full javascript file <a href="inputStore.jquery.js" target="_blank">here</a>
or the minified version <a href="inputStore.jquery.min.js" target="_blank">here</a>.</li>
<li> You can reference the latest jquery file on this website by using the following script tag:<br>
<code>
<script src="https://inputstore.netlify.com/inputStore.jquery.min.js"></script>
</code>
</li>
<li>
Requires jQuery proper (2.0+) to operate
</li>
</ol>
</div>
<hr>
</div>
<div class="example">
<h3> Example 1 - Defaults </h3>
<p>
Given the following HTML input field:
</p>
<code>
<input id="example1" type="text" name="example1field"></input>
</code>
<p>
and the following javascript initialization code:
</p>
<code>
$("#example1").inputStore();
</code>
<p>
You will get the following working example form input:
</p>
<p>
<input id="example1" type="text" name="example1field"></input>
</p>
<p>
By default this input field will store the values as cookies when they
are entered into the browser for 365 days. The cookie name default's
to the input field name. In this case it defaults to example1field.</p>
<hr>
</div>
<div class="example">
<h3> Example 2 - With Configuration</h3>
<p>
Given the following HTML input field:
</p>
<code>
<input id="example2" type="text" name="example2field"></input>
</code>
<p>
and the following javascript initialization code:
</p>
<code>
$("#example2").inputStore({<br>
name: "CustomOptions",<br>
expire: 120,<br>
debug: true<br>
});<br>
</code>
<p>
You will get the following working example form input:
</p>
<p>
<input id="example2" type="text" name="example2field"></input>
</p>
<div>
<p>
This code snippet overrides the current defaults.
</p>
<ol>
<li>It uses the cookie name CustomOptions rather than the input name of example2field.</li>
<li>It settings the expiry to 120 days instead of the default 365 days.</li>
<li>It enables debug which shows you what the cookie stored value is and the newly stored values are in the javascript console.</li>
</ol>
</div>
<hr>
<div class="allUses">
<h3> All Form Block Examples </h3>
<div>
<p><strong> 1. Text Input Blocks </strong></p>
<div>
<input id="inputBlock" type="text" name="inputBlock"></input><br>
<code>
<input id="inputBlock" type="text" name="inputBlock"></input><br>
$("#inputBlock").inputStore();
</code><br>
</div>
</div>
<div>
<p><strong> 2. Number Input Blocks </strong></p>
<input id="numberBlock" type="number" name="numberBlock"></input><br>
<code>
<input id="numberBlock" type="number" name="numberBlock"></input><br>
$("#numberBlock").inputStore();
</code><br>
</div>
<div>
<p><strong> 3. Check Box Blocks </strong></p>
<input id="checkboxBlock" type="checkbox" name="checkboxBlock"></input><br>
<code>
<input id="checkboxBlock" type="checkbox" name="checkboxBlock"></input><br>
$("#checkboxBlock").inputStore();
</code><br>
</div>
<div>
<p><strong> 4. Select Blocks </strong></p>
<select id="selectBlock" name="selectBlock">
<option value="OptionA">Option A</option>
<option value="OptionB">Option B</option>
<option value="OptionC">Option C</option>
</select><br>
<code>
<select id="selectBlock" name="selectBlock"><br>
<option value="OptionA">Option A</option><br>
<option value="OptionB">Option B</option><br>
<option value="OptionC">Option C</option><br>
</select><br>
$("#selectBlock").inputStore();
</code><br>
</div>
<div>
<p><strong> 5. Text Area Blocks </strong></p>
<textarea id="textareaBlock" name="textareaBlock"></textarea> <br>
<code>
<textarea id="textareaBlock" name="textareaBlock"></textarea><br>
$("#textareaBlock").inputStore();
</code><br><br>
</div>
</div>
<hr>
</div>
</body>
<script src="exampleSetup.js"></script>
</html>