summaryrefslogtreecommitdiffstats
path: root/jquery.multiple.select.js
diff options
context:
space:
mode:
authorBrett Zamir <brettz9@yahoo.com>2014-06-10 11:24:07 +0800
committerBrett Zamir <brettz9@yahoo.com>2014-06-10 11:24:07 +0800
commitf063881fb07d5cc3f3ad97d583948ddb6ecfb6ea (patch)
tree9a467217ffd0dfc4fe51bc74f7153cce316bb422 /jquery.multiple.select.js
parent5a57a89e08c2ade058e36c0e4919d6d1cb6e8167 (diff)
downloadmultiple-select-f063881fb07d5cc3f3ad97d583948ddb6ecfb6ea.zip
multiple-select-f063881fb07d5cc3f3ad97d583948ddb6ecfb6ea.tar.gz
multiple-select-f063881fb07d5cc3f3ad97d583948ddb6ecfb6ea.tar.bz2
Add a filterAcceptOnEnter option
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r--jquery.multiple.select.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index 05a3cf8..7ee9178 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -171,7 +171,16 @@
break;
}
});
- this.$searchInput.off('keyup').on('keyup', function() {
+ this.$searchInput.off('keyup').on('keyup', function(e) {
+ if (that.options.filterAcceptOnEnter &&
+ (e.which === 13 || e.which == 32) && // enter or space
+ that.$searchInput.val() // Avoid selecting/deselecting if no choices made
+ ) {
+ that.$selectAll.click();
+ that.close();
+ that.focus();
+ return;
+ }
that.filter();
});
this.$selectAll.off('click').on('click', function() {