diff options
author | 文翼 <wenzhixin2010@gmail.com> | 2014-06-10 11:43:17 +0800 |
---|---|---|
committer | 文翼 <wenzhixin2010@gmail.com> | 2014-06-10 11:43:17 +0800 |
commit | 1153b6fd9265039cafad6f297a068128ff14c2fb (patch) | |
tree | 43ae42e7b6562ca164e1bbd95f37aa3bc1be0ea5 /jquery.multiple.select.js | |
parent | 5be8b0265ea35a999d481975654dbb875a7486d9 (diff) | |
parent | f063881fb07d5cc3f3ad97d583948ddb6ecfb6ea (diff) | |
download | multiple-select-1153b6fd9265039cafad6f297a068128ff14c2fb.zip multiple-select-1153b6fd9265039cafad6f297a068128ff14c2fb.tar.gz multiple-select-1153b6fd9265039cafad6f297a068128ff14c2fb.tar.bz2 |
Merge pull request #93 from brettz9/filterAcceptOnEnter-option
Add a filterAcceptOnEnter option
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r-- | jquery.multiple.select.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js index cf858b3..95269c0 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() { |