4

Following is my code:

var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++",
"Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell",
"Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];

$("#City").autocomplete({
        source: availableTags
});

From Docs, the default behavior is a kind of dropdown the matched items. But for me it is showing like

Screenshot:

10 results are available, use up and down arrow keys to navigate.

enter image description here

Sorry, I couldn't reproduce this behavior in jsfiddle. The navigation is done using up and down arrow keys. I don't want this, how can I revert back to default dropdown? Please share your suggestions.

Updates:

With @Anton reference, I was able to remove the validation message, however the dropdown is not showing. But I am able to navigate using up/down arrow keys. Any feedback on this?

2
  • 1
    Found something here that might fix the problem stackoverflow.com/questions/13011127/… Commented Sep 11, 2013 at 7:15
  • try to include it in a function like $(function() {} Commented Sep 11, 2013 at 7:19

4 Answers 4

5

Try this according to this answer on SO

$("#City").autocomplete({
    source: availableTags,
    messages: {
        noResults: '',
        results: function() {}
    }
});
Sign up to request clarification or add additional context in comments.

2 Comments

+1 Thanks this helps to remove the validation message, however still the dropdown is not showing only navigation using up/down key. Any thoughts on this?
@user1671639 I'm not sure, but i've been looking around and it might be z-index problems, try this ul.ui-autocomplete.ui-menu { z-index: 1000; }
2

You have to add jquery-ui.css in your project folder and link it.

Edit the ui-autocomplete in the above .css and add z-index = 4000 into that. Your dropdown should work fine.

Comments

0

Anton is right.

Also please note I think it's not a best practice to use some id starting in capital :)

$("#city")

Use this example on fiddle.

Comments

0

I got same problem and solve it with that annoying tooltip by including default css style file for jquery.ui.

<link rel="stylesheet" href="jquery-ui/themes/base/jquery-ui.min.css" />

Just forgot to do this after including jquery-ui javascript source file jquery-ui.min.js.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.