I need help understanding the jquery ui autocomplete example found here: http://jqueryui.com/demos/autocomplete/#remote
If you click on the source
$(function() {
function log( message ) {
$( "</div>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#birds" ).autocomplete({
source: "search.php",
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
});
You'll see that when you select a suggested entry, that entry's information will be parsed into the log. However, is there an actual use case where ui.item evaluates to false and the 2nd statement executes and gets stored in the log?
Autocomplete select event: "Triggered when an item is selected from the menu; ui.item refers to the selected item".
If ui.item is false no item was selected, but then the autocomplete select event would't have fired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With