Permalink
Browse files

added a tabIndex option

  • Loading branch information...
1 parent b422435 commit 9dc00cfa4b842d0a65f9677c5ec0943261d6173c @aehlke committed Feb 7, 2011
Showing with 10 additions and 2 deletions.
  1. +6 −0 README.markdown
  2. +4 −2 js/tag-it.js
View
6 README.markdown
@@ -165,6 +165,12 @@ If this is not set, we create an input node for it, with the name given in **fie
Defalts to *null*
+### tabIndex (integer)
+Optionally set a *tabindex* attribute on the input that gets created for tag-it.
+
+Defaults to *null*
+
+
## Authors
* [Levy Carneiro Jr.](http://github.com/levycarneiro)
View
6 js/tag-it.js
@@ -29,19 +29,21 @@
'singleField': false, // When enabled, will use a single hidden field for the form, rather than one per tag.
// It will delimit tags in the field with singleFieldDelimiter.
'singleFieldDelimiter': ',',
- 'singleFieldNode': null // Set this to an input DOM node to use an existing form field.
+ 'singleFieldNode': null, // Set this to an input DOM node to use an existing form field.
// Any text in it will be erased on init. But it will be populated with
// the text of tags as they are created, delimited by singleFieldDelimiter.
// If this is not set, we create an input node for it, with the name
// given in settings.fieldName, ignoring settings.itemName.
+
+ 'tabIndex': null // Optionally set a tabindex attribute on the input that gets created for tag-it.
};
if (options) {
$.extend(settings, options);
}
var tagList = $(this),
- tagInput = $('<input class="tagit-input" type="text" />');
+ tagInput = $('<input class="tagit-input" type="text" ' + (settings.tabIndex ? 'tabindex="' + settings.tabIndex + '"' : '') + '/>');
BACKSPACE = 8,
ENTER = 13,
SPACE = 32,

0 comments on commit 9dc00cf

Please sign in to comment.