-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathautotabindex.js
More file actions
44 lines (38 loc) · 1.31 KB
/
autotabindex.js
File metadata and controls
44 lines (38 loc) · 1.31 KB
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
/**
* @name jQuery Auto TabIndex Plugin
* @author VTwo Group
* @version 0.1
* @url http://vtwo.org/jquery/plugin/autotabindex/
* @license MIT License
*/
(function($) {
$.fn.autotabindex = function(options) {
var settings = $.extend({
list: '',
classname: ''
}, options);
//Remove all
var counter = 1;
var el = $('*');
var kids = el.children();
kids.removeAttr('tabindex');
if(settings.list!='')
{
var array = settings.list.split(',');
for(var i=0; i<array.length; i++)
{
kids.filter(array[i]).attr('tabindex', counter);
//Add and Remove Class
if(settings.classname)
{
kids.filter(array[i]).focusin(function(){
$(this).addClass(settings.classname);
});
kids.focusout(array[i]).blur(function(){
$(this).removeClass(settings.classname);
});
}
counter++;
}
}
}}(jQuery));