Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery UI Autocomplete, value after select (by mouse) is different than (by arrow-keys)

I'm using jQuery UI Autocomplete 1.8.1 with Jquery 1.4.2 and I have this issue.

At first, I can't force the value of the Autocomplete input field, well this is not a big problem.

But I have this issue with it:

I doesn't act similarly when a user select a choice using mouse to using keyboard arrows. When using keyboard everything is fine and the value appears after select in the input text box, but when using mouse it sticks with the old (typed) value not the selected one.

How to control this (textbox value after select)? and why there are different behaviours?

P.S: changing the value of the input box inside the select function is useless since it can't be done!

like image 248
Omar Al-Ithawi Avatar asked Jun 16 '10 18:06

Omar Al-Ithawi


2 Answers

or you can add it in select

select: function( event, ui ) {
    $('#input').val(ui.item.value);
}
like image 148
somy Avatar answered Oct 28 '22 10:10

somy


I had a similar problem to this.

When using the keyboard the focus from the text box is lost, but on click the focus goes back to the text box.

It could be that you have something happening on the focus of the input field which is being re-triggered?

like image 33
Jonny White Avatar answered Oct 28 '22 09:10

Jonny White