tnr23
tnr23

Reputation: 693

JQuery UI Autocomplete, not selecting a value on enter if mouseover

I have a problem with JQuery UI Autocomplete.

I want it to behave like this:
If I have positioned my mouse right under the input and entering values, so the autocomplete appears and press enter, the script will select the value from the autocomplete list. I'd rather want the script to just close and select the user entered value.

In short form: I want autocomplete just to replace the input text if a user actually clicks on a suggestion.

Is this possible somehow?

Best Regards

Upvotes: 1

Views: 631

Answers (1)

Christophe Roussy
Christophe Roussy

Reputation: 16999

You can play with the select event:

select : function(event, selectedObject) {
  jQuery(this).val(selectedObject.item.value);
}

Upvotes: 1

Related Questions