Skip to content
This repository was archived by the owner on Sep 10, 2023. It is now read-only.

Commit a7750fa

Browse files
committed
Merge pull request #416 from pwmckenna/master
tab out support
2 parents c4c3ccd + 1c74b10 commit a7750fa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/jquery.tokeninput.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var DEFAULT_SETTINGS = {
5454

5555
// Behavioral settings
5656
allowFreeTagging: false,
57+
allowTabOut: false,
5758

5859
// Callbacks
5960
onResult: null,
@@ -334,9 +335,16 @@ $.TokenList = function (input, url_or_data, settings) {
334335
hidden_input.change();
335336
} else {
336337
if ($(input).data("settings").allowFreeTagging) {
337-
add_freetagging_tokens();
338+
if($(input).data("settings").allowTabOut && $(this).val() === "") {
339+
return true;
340+
} else {
341+
add_freetagging_tokens();
342+
}
338343
} else {
339344
$(this).val("");
345+
if($(input).data("settings").allowTabOut) {
346+
return true;
347+
}
340348
}
341349
event.stopPropagation();
342350
event.preventDefault();

0 commit comments

Comments
 (0)