Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

add support for space key when add a tag #346

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
bower_components/
lib/
.idea/
4 changes: 3 additions & 1 deletion src/jquery.tagsinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
}
// if user types a default delimiter like comma,semicolon and then create a new tag
$(data.fake_input).bind('keypress',data,function(event) {
console.log('keypress');
if (_checkDelimiter(event)) {
event.preventDefault();
if( (event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length)) )
Expand Down Expand Up @@ -369,7 +370,8 @@
*/
var _checkDelimiter = function(event){
var found = false;
if (event.which == 13) {
//(add support for the space key)
if (event.which == 13 || event.which == 32) {
return true;
}

Expand Down