Share via


AutoSuggestBox.chooseSuggestionOnEnter property

Gets or sets whether the first suggestion is chosen when the user presses Enter.

Syntax

<div 
    data-win-control="WinJS.UI.AutoSuggestBox" 
    data-win-options="{ chooseSuggestionOnEnter : value}" >
</div>
var chooseSuggestionOnEnter = autoSuggestBox.chooseSuggestionOnEnter;
autoSuggestBox.chooseSuggestionOnEnter = chooseSuggestionOnEnter;

Property value

Type: Boolean

true if the first suggestion should be automatically chosen when the user presses Enter; false if the user must explicitly move focus to the first item for Enter to select it. The default value is false.

Remarks

When this property is true, as the user types in the auto-suggest box, a focus rectangle is drawn on the first suggestion (if present and no IME composition in progress). Pressing Enter will behave the same as if the user clicked on the focused suggestion, and the down arrow key press will put real focus to the second suggestion and the up arrow key will remove focus.

Requirements

Minimum WinJS version

WinJS 4.0

Namespace

WinJS.UI

See also

AutoSuggestBox