Edit in JSFiddle

var availableTags = [
            "ActionScript",
            "AppleScript",
            "Asp",
            "BASIC",
            "C",
            "C++",
            "Clojure",
            "COBOL",
            "ColdFusion",
            "Erlang",
            "Fortran",
            "Groovy",
            "Haskell",
            "Java",
            "JavaScript",
            "Lisp",
            "Perl",
            "PHP",
            "Python",
            "Ruby",
            "Scala",
            "Scheme"
        ];

$("#auto").autocomplete({
    source: availableTags
});
<ol>
    <li>Type "ac" to get "ActionScript" in the suggestion list.</li>
    <li>Press the "DOWN" arrow to focus on the item and populate the input</li>
    <li>Move your mouse over the "ActionScript" suggestion</li>
    <li>The input's value will be reset to "ac"</li>
    </ol>

<input type="text" id="auto" />
ol { margin-left: 30px; list-style-type: decimal; }

External resources loaded into this fiddle: