Skip to content

Instantly share code, notes, and snippets.

@rpersaud
Created January 4, 2012 22:22
Figuring out the most efficient javascript method for autocomplete
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
<meta charset="utf-8">
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
</script>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</div>
@rpersaud
Copy link
Author

rpersaud commented Jan 4, 2012

Minimum files to get this to work - jquery, jquery-ui, jquery-ui-css.

@rpersaud
Copy link
Author

rpersaud commented Jan 4, 2012

@rpersaud
Copy link
Author

rpersaud commented Jan 4, 2012

Question - is this the most efficient, easy to setup, and use autocomplete method out there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment