5 <title>jQuery UI Autocomplete - Remote datasource</title>
6 <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7 <script src="../../jquery-1.9.1.js"></script>
8 <script src="../../ui/jquery.ui.core.js"></script>
9 <script src="../../ui/jquery.ui.widget.js"></script>
10 <script src="../../ui/jquery.ui.position.js"></script>
11 <script src="../../ui/jquery.ui.menu.js"></script>
12 <script src="../../ui/jquery.ui.autocomplete.js"></script>
13 <link rel="stylesheet" href="../demos.css">
15 .ui-autocomplete-loading {
16 background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat;
21 function log( message ) {
22 $( "<div>" ).text( message ).prependTo( "#log" );
23 $( "#log" ).scrollTop( 0 );
26 $( "#birds" ).autocomplete({
29 select: function( event, ui ) {
31 "Selected: " + ui.item.value + " aka " + ui.item.id :
32 "Nothing selected, input was " + this.value );
40 <div class="ui-widget">
41 <label for="birds">Birds: </label>
45 <div class="ui-widget" style="margin-top:2em; font-family:Arial">
47 <div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
50 <div class="demo-description">
51 <p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are bird names, displayed when at least two characters are entered into the field.</p>
52 <p>The datasource is a server-side script which returns JSON data, specified via a simple URL for the source-option. In addition, the minLength-option is set to 2 to avoid queries that would return too many results and the select-event is used to display some feedback.</p>