'Autocomplete shows only message N results are available, use up and down arrow keys to navigate. instead show list
my problem is clear.
I'm using jquery autocomplete and i don't know why it shows me only the message:
9 results are available, use up and down arrow keys to navigate.
Without showing me the list of result.
This is my code:
<p class="select-c">
<label for="fcb">Location</label>
<input id="fcb" name="fcb" type="text">
</p>
$("#fcb").autocomplete({
source: function (request, response) {
$.ajax({
type: "GET",
dataType: 'json',
url: "../ws/city/" + request.term,
async: true,
success: function( data ) {
response( $.map( data, function( item,key ) {
return {
label: key,
value: item.id_town+"#"+item.id_province
}
}));
},
error: function (result) {
alert("Due to unexpected errors we were unable to load data");
}
});
},
minLength: 2
});
with results like:
What could be the problem??
Solution 1:[1]
Check your CSS, maybe you are hiding the menu element. Try with:
.ui-autocomplete {
z-index: 10000000;
}
Solution 2:[2]
Just check if you are importing the correct css to correct the list rendering
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
And if you also want to remove the message, add the following entry after source
$("#fcb").autocomplete({
//your source info
messages: {
noResults: '',
results: function() {}
}
});
Solution 3:[3]
.ui-helper-hidden-accessible {
display: none;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jonathan Naguin |
Solution 2 | Anurag |
Solution 3 | Ngannv |