Reputation: 562
I want to show all data whatever I input. for example:
data = ["aaa", "bbb", "ccc"]
$( "#tag_field" ).autocomplete({
source: data
});
when I input "d", it suggest me all data. just show all data whatever I input. How can I do that?
Upvotes: 0
Views: 1060
Reputation: 164
Maybe this could be a solution:
data = ["aaa", "bbb", "ccc"];
$( "#tag_field" ).autocomplete({
source: data,
response: function( event, ui ) {
ui.content.splice(0,ui.content.length);
$.each(data,function(i,n){
ui.content.push({label:n, value:n});
});
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0-beta.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0-beta.1/themes/smoothness/jquery-ui.css">
<input id="tag_field" type="text">
Upvotes: 1