jQueryUI 1.8.14 Autocomplete

by Joe Cisneros

HTML

<script src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/themes/black-tie/jquery-ui.css">
<input type="text" id="auto" />

<a href="https://jqueryui.com/autocomplete/" target="_blank">jQueryUI Autocomplete Documentation</a>

JavaScript

var tags = [
      "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: tags,
    minLength: 0
});

$("#auto").bind("focus", function () {
    this.value = '';
    $(this).autocomplete("search", '');
});