Jquery autocomplete select first item on enter key

Jquery autocomplete select first item on enter key

Author: AndreS08 Date of post: 07.07.2017

javascript - Select first jquery UI result automatically - Stack Overflow

Though it may be a duplicate question but i'm not able to find a solution. I have a text box for searching using jQuery autocomplete.

When I type something in text box, it is showing the suggestions out of which none is selected. I found out that selectFirst: If I select an item in the drop down list and press enter, it is working fine. The problem is that if user enters app for apple and presses the enter key, it tries to submit the form with app.

The form should only be submitted with one of the values from the drop down list. I tried to disable the form submit on pressing enter so that I could submit form from JavaScript but couldn't find a solution.

jquery autocomplete select first item on enter key

Please help me on this:. Note that there is and not 'submit', so default enter pressing should not work for form.

Autocomplete: Automatically select first item in dropdown OR add item into drop down menu - jQuery Forum

It jquery autocomplete select first item on enter key the autocomplete i guess that is submitting the form on submit. If you are using this: If you are headlines from the stock market crash of 1929 facts jquery ui for auto complete, all you need is specifying the autoFocus: It will automatically select the first result and when hit enter key it will use the jquery autocomplete select first item on enter key result.

By posting your answer, you agree to the privacy policy and terms of service. Stack Overflow Questions Developer Jobs Documentation beta Tags Users.

jquery autocomplete select first item on enter key

Sign up or log in to customize your list. Tour Start here for a quick overview of the site Animal crossing make bells fast Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us. Log In Sign Up. Join the Stack Overflow Community.

Stack Overflow is a community of 7. Join them; it only takes a minute: Please help me on this: Here is my code: Ashutosh 2 14 Would it be fine if like you expect selectFirst option to work, you can have the first option to be focused by default?

Annie C 2 7 Sign up or log in StackExchange. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Stack Overflow works best with JavaScript enabled. Thanks in advance jquery autocomplete share improve this question. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

Rating 4,6 stars - 355 reviews
inserted by FC2 system