4
4
< head >
5
5
< title > jQuery Autotab Demo</ title >
6
6
< meta http-equiv ="Content-Type " content ="text/html; charset=utf-8 " />
7
- < script src ="http://code.jquery.com/jquery-1.11.0 .min.js "> </ script >
7
+ < script src ="http://code.jquery.com/jquery-1.11.1 .min.js "> </ script >
8
8
< script src ="js/jquery.autotab.js "> </ script >
9
9
< script >
10
10
$ ( function ( ) {
11
- $ ( 'input[type=text], input[type=password]' ) . autotab ( ) ;
11
+ $ . autotab ( { tabOnSelect : true } ) ;
12
12
$ ( '.number' ) . autotab ( 'filter' , 'number' ) ;
13
- $ ( '.ssn' ) . autotab ( 'filter' , 'number' ) ;
14
13
$ ( '.text' ) . autotab ( 'filter' , 'text' ) ;
15
14
$ ( '.alpha' ) . autotab ( 'filter' , 'alpha' ) ;
16
15
$ ( '.alphanumeric' ) . autotab ( 'filter' , { format : 'alphanumeric' , uppercase : true } ) ;
41
40
} ) ;
42
41
$ ( '.hexadecimal' ) . autotab ( 'filter' , 'hexadecimal' ) ;
43
42
$ ( '.ip' ) . autotab ( 'filter' , { format : 'number' , trigger : '.' } ) ;
44
- $ ( '.pin' ) . autotab ( 'filter' , { format : 'number' } ) ;
43
+ $ ( '.pin' ) . autotab ( 'filter' , 'number' ) ;
45
44
46
45
$ ( '#remove-autotab' ) . on ( 'click' , function ( ) {
47
- $ ( 'input[type=text]' ) . autotab ( ' remove' ) ;
46
+ $ . autotab . remove ( ) ;
48
47
$ ( '#autotab-status span' ) . removeClass ( 'on' ) . addClass ( 'off' ) . text ( 'Off' ) ;
49
48
} ) ;
50
49
51
50
$ ( '#restore-autotab' ) . on ( 'click' , function ( ) {
52
- $ ( 'input[type=text]' ) . autotab ( ' restore' ) ;
51
+ $ . autotab . restore ( ) ;
53
52
$ ( '#autotab-status span' ) . removeClass ( 'off' ) . addClass ( 'on' ) . text ( 'On' ) ;
54
53
} ) ;
54
+
55
+ $ ( '' ) . on ( 'click' , function ( ) {
56
+ } ) ;
55
57
} ) ;
56
58
</ script >
57
59
104
106
display : inline-block;
105
107
font-size : 14px ;
106
108
margin : 10px 0 ;
107
- outline : none;
109
+ /* outline: none;*/
108
110
padding : 6px 12px ;
109
111
position : relative;
110
112
text-align : center;
129
131
< body >
130
132
< div id ="container ">
131
133
< h1 > jQuery Autotab Demo</ h1 >
132
- < p > Autotab's documentation can be found in < a href ="https://github.com/Mathachew/jquery-autotab/blob/master/README.md "> ReadMe.md</ a > on GitHub.</ p >
134
+ < p > Autotab's full documentation can be found in < a href ="https://github.com/Mathachew/jquery-autotab/blob/master/README.md "> ReadMe.md</ a > on GitHub.</ p >
135
+
136
+ < hr />
137
+
138
+ < p > < strong > Note:</ strong > For the purposes of this demo, I am calling < code > $.autotab()</ code > to initialize the auto tabbing order.</ p >
133
139
134
140
< hr />
135
141
@@ -154,44 +160,7 @@ <h1>jQuery Autotab Demo</h1>
154
160
< input type ="text " id ="number3 " class ="number " maxlength ="4 " size ="5 " />
155
161
</ div >
156
162
< pre >
157
- // Example 1
158
- $('input[type=text]').autotab();
159
- $('.number').autotab('filter', 'number');
160
-
161
- // Example 2
162
- $('.number').autotab();
163
163
$('.number').autotab('filter', 'number');
164
-
165
- // Example 3
166
- $('#number1').autotab({ format: 'number', target: '#number2' });
167
- $('#number2').autotab({ format: 'number', target: '#number3', previous: '#number1' });
168
- $('#number3').autotab({ format: 'number', target: '#ssn1', previous: '#number2' });
169
-
170
- // Example 4
171
- // Note: Applies number formatting to all elements, but the last element lacks a target
172
- $('.number').autotab({ format: 'number' });
173
- $('#number3').autotab({ target: '#ssn1' });
174
- </ pre >
175
- </ div >
176
-
177
- < div >
178
- < p > Examples from this point on will assume < code > $('input[type=text]').autotab()</ code > is called.</ p >
179
- </ div >
180
-
181
- < hr />
182
-
183
- < div >
184
- < div class ="example ">
185
- < label for ="ssn1 "> Social Security Number</ label >
186
-
187
- < input type ="text " id ="ssn1 " class ="ssn " maxlength ="3 " size ="3 " />
188
- -
189
- < input type ="text " id ="ssn2 " class ="ssn " maxlength ="2 " size ="3 " />
190
- -
191
- < input type ="text " id ="ssn3 " class ="ssn " maxlength ="4 " size ="5 " />
192
- </ div >
193
- < pre >
194
- $('.ssn').autotab('filter', 'number');
195
164
</ pre >
196
165
</ div >
197
166
@@ -256,28 +225,6 @@ <h1>jQuery Autotab Demo</h1>
256
225
257
226
< hr />
258
227
259
- < div >
260
- < div class ="example ">
261
- < label for ="all1 "> Any and all characters</ label >
262
-
263
- < input type ="text " id ="all1 " class ="all " maxlength ="5 " size ="4 " />
264
- -
265
- < input type ="text " id ="all2 " class ="all " maxlength ="5 " size ="4 " />
266
- -
267
- < input type ="text " id ="all3 " class ="all " maxlength ="5 " size ="4 " />
268
- -
269
- < input type ="text " id ="all4 " class ="all " maxlength ="5 " size ="4 " />
270
- -
271
- < input type ="text " id ="all5 " class ="all " maxlength ="5 " size ="4 " />
272
- </ div >
273
- < pre >
274
- // Note: This call is not necessary as 'all' is the default format
275
- $('.all').autotab('filter', 'all');
276
- </ pre >
277
- </ div >
278
-
279
- < hr />
280
-
281
228
< div >
282
229
< div class ="example ">
283
230
< label for ="regex "> Regular Expression (Allows numbers and periods)</ label >
@@ -292,7 +239,7 @@ <h1>jQuery Autotab Demo</h1>
292
239
293
240
< div >
294
241
< div class ="example ">
295
- < label for ="function "> Custom Function (Range of 1-12, even if the second digit is greater than 2) </ label >
242
+ < label for ="function "> Custom Function that forces a number range of 1 to 12 </ label >
296
243
< input type ="text " id ="function " maxlength ="2 " size ="3 " />
297
244
</ div >
298
245
< pre >
@@ -380,7 +327,39 @@ <h1>jQuery Autotab Demo</h1>
380
327
< input type ="password " id ="pin2 " class ="pin " maxlength ="3 " size ="4 " />
381
328
</ div >
382
329
< pre >
383
- $('.pin').autotab('filter', { format: 'number' });
330
+ $('.pin').autotab('filter', 'number');
331
+ </ pre >
332
+ </ div >
333
+
334
+ < hr />
335
+
336
+ < div >
337
+ < div class ="example ">
338
+ < label for ="all1 "> Any and all characters with tabbing support on non-text form fields. Textarea will auto tab when the defined < code > maxlength</ code > is reached, disabled fields are skipped entirely, and the select list will auto tab when a value is selected. Auto tabbing on select lists only applies for single select and is configurable using < code > tabOnSelect</ code > .</ label >
339
+
340
+ < input type ="text " id ="all1 " class ="all " maxlength ="5 " size ="4 " />
341
+ < input type ="text " id ="all2 " class ="all " maxlength ="3 " size ="1 " disabled ="disabled " value ="zxy " />
342
+ < input type ="text " id ="all3 " class ="all " maxlength ="5 " size ="4 " />
343
+ < br />
344
+ < button value ="button "> Standard Button</ button > < input type ="submit " value ="Submit Button " /> < button value ="button " disabled ="disabled "> Disabled Button</ button >
345
+ < br />
346
+ < select >
347
+ < option > First</ option >
348
+ < option > Second</ option >
349
+ < option > Third</ option >
350
+ </ select >
351
+ < br />
352
+ < input type ="radio " name ="radio " />
353
+ < br />
354
+ < input type ="checkbox " />
355
+ < br />
356
+ < textarea cols ="20 " rows ="2 " maxlength ="10 " class ="all "> </ textarea >
357
+ < br />
358
+ < input type ="text " id ="all4 " class ="all " maxlength ="5 " size ="4 " />
359
+ </ div >
360
+ < pre >
361
+ // Note: This call is not necessary as 'all' is the default format
362
+ $('.all').autotab('filter', 'all');
384
363
</ pre >
385
364
</ div >
386
365
</ div >
0 commit comments