diff --git a/jqm.autoComplete-1.5.1.js b/jqm.autoComplete-1.5.1.js index c9ab923..69bf96a 100755 --- a/jqm.autoComplete-1.5.1.js +++ b/jqm.autoComplete-1.5.1.js @@ -31,7 +31,8 @@ interval : 0, builder: null, dataHandler : null, - class: null + class: null, + forceFirstChoiceOnEnterKey : true }, openXHR = {}, buildItems = function($this, data, settings) { @@ -116,7 +117,7 @@ .removeClass('ui-btn-active').nextAll('li.ui-btn:eq(0)') .addClass('ui-btn-active').length || $('.ui-btn:first', $(settings.target)).addClass('ui-btn-active'); - } else if (e.keyCode === 13) { + } else if (e.keyCode === 13 && settings.forceFirstChoiceOnEnterKey) { $('.ui-btn-active a', $(settings.target)).click().length || $('.ui-btn:first a', $(settings.target)).click(); } } diff --git a/readme.md b/readme.md index abcf894..9438174 100755 --- a/readme.md +++ b/readme.md @@ -31,7 +31,8 @@ Clone the git repo - `git clone https://github.com/commadelimited/autoComplete.j onLoading: fn(), // optional callback function called just prior to ajax call onLoadingFinished: fn(), // optional callback function called just after ajax call has completed datahandler : fn(), // optional function to convert the received JSON data to the format described below - class: 'tinted' // optional class name for listview's
  • tag + class: 'tinted', // optional class name for listview's
  • tag + forceFirstChoiceOnEnterKey : true // force the first choice in the list when Enter key is hit }); AutoComplete can access local arrays or remote data sources.