Check out the search
method documentation:
Triggers a search event, which, when
data is available, then will display
the suggestions; can be used by a
selectbox-like button to open the
suggestions when clicked. If no value
argument is specified, the current
input’s value is used. Can be called
with an empty string and minLength: 0
to display all items.
var source = ['One', 'Two', 'Three', 'Four'];
var firstVal = source[0];
$("input#autocomplete").autocomplete({
minLength: 0,
source: source,
}).focus(function() {
$(this).autocomplete("search", $(this).val());
});
.ui-menu-item{
background : rgb(215, 215, 215);;
border : 1px solid white;
list-style-type: none;
cursor : pointer;
}
.ui-menu-item:hover{
background : rgb(200, 200, 200);
}
.ui-autocomplete{
padding-left:0;
margin-top : 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"></script>
<input id="autocomplete"/> <input id="submit" type="submit"/>