Skip to content

Commit

Permalink
added a tabIndex option
Browse files Browse the repository at this point in the history
  • Loading branch information
aehlke committed Feb 7, 2011
1 parent b422435 commit 9dc00cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions js/tag-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9dc00cf

Please sign in to comment.