sketch.html revision c37abbc213f0af9ddae183d71f738e00107fea84
<!DOCTYPE html>
<html>
<head>
<style>
script {
clear:left;
white-space:pre;
display:block;
font-family:monospace;
background:#eef;
}
script::before, script::after {
content:"<script>";
float:left;
display:block;
background:#fff;
}
script::after { content:"</script>"; }
script[src]::before {
content:"<script src=\"" attr(src) "\">";
white-space:nowrap;
}
</style>
<title>autocomplete exploration</title>
</head>
<body>
<form>
<label for="ac">
INPUT!
</label>
<input name="ac" id="ac" type="text">
<input type="submit">
</form>
<script>
YUI().use('autocomplete', function (Y) {
// same server, will use xhr
// will use jsonp
Y.get("#ac").autocomplete("http://example.com/data/{query}");
// direct array of things to use.
Y.get("#ac").autocomplete([
{ name : "Schlueter", data : "/isaac" },
{ name : "Simple", data : "/" },
{ name : "Super", data : "http://example.com" }
]);
// all of these return an autocomplete instance, like a Y.Node, but
// with some decorations.
Y.get("#ac").autocomplete(...)
.on("select", ...)
.set("filter", ...);
});
</script>
</body>
</html>