Skip to content

Instantly share code, notes, and snippets.

@ghinch
Created December 22, 2010 19:30
Show Gist options
  • Save ghinch/751970 to your computer and use it in GitHub Desktop.
Save ghinch/751970 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>AC Test</title>
<script src="http://yui.yahooapis.com/3.3.0pr3/build/yui/yui-min.js"></script>
</head>
<body>
<input type="text" id="n" value="foo">
<script type="text/javascript">
YUI().use('autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', 'autocomplete-plugin', 'datasource', function (Y) {
var n = Y.one('#n'),
data = [
'foo',
'bar',
'baz'
],
source = new Y.DataSource.Local({
source : data
});
n.plug({fn : Y.Plugin.AutoComplete, cfg :{
source : source,
resultFilters : [Y.AutoCompleteFilters.startsWith],
minQueryLength : 0,
queryDelay : 0,
resultHighlighter : Y.AutoCompleteHighlighters.startsWidth
}})
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment