Minimal Jquery Autocomplete

Here is a not-too-ugly minimal example of JQueryUI Autocomplete w/o needing to bring in all of the CSS from Jquery

HTML

<input type='text' title='Tags' id='tags' />

JavaScript

$(document).ready(function() {
    
    var aTags = ["ask","always", "all", "alright", "one", "foo", "blackberry", "tweet","force9", "westerners", "sport"];

    $( "#tags" ).autocomplete({
        //source option can be an array of terms.  In this case, if
    // the typed characters appear in any position in a term, then the
    // term is included in the autocomplete list.
    // The source option can also be a function that performs the search,
    // and calls a response function with the matched entries.
    source: function(req, responseFn) {
        var re = $.ui.autocomplete.escapeRegex(req.term);
        var matcher = new RegExp( "^" + re, "i" );
        var a = $.grep( aTags, function(item,index){
            return matcher.test(item);
        });
        responseFn( a );
    }
});
});