Navigation Menu

Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
optionally do not force the first choice in the list when the enter k…
Browse files Browse the repository at this point in the history
…ey is hit
  • Loading branch information
nolanlawson committed May 22, 2013
1 parent 20aafbf commit a1cca42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions jqm.autoComplete-1.5.1.js
Expand Up @@ -31,7 +31,8 @@
interval : 0,
builder: null,
dataHandler : null,
class: null
class: null,
forceFirstChoiceOnEnterKey : true
},
openXHR = {},
buildItems = function($this, data, settings) {
Expand Down Expand Up @@ -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();
}
}
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Expand Up @@ -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 <li> tag
class: 'tinted', // optional class name for listview's <li> tag
forceFirstChoiceOnEnterKey : true // force the first choice in the list when Enter key is hit
});

AutoComplete can access local arrays or remote data sources.
Expand Down

0 comments on commit a1cca42

Please sign in to comment.