Skip to content

Instantly share code, notes, and snippets.

@JackNova
Forked from benediktarnold/combo.html
Created December 8, 2013 23:39
Show Gist options
  • Save JackNova/7865204 to your computer and use it in GitHub Desktop.
Save JackNova/7865204 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>
</title>
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js">
</script>
<link rel="stylesheet" type="text/css" href="css/combo.css">
</head>
<body class="yui3-skin-sam">
<div class="combo">
<input type="text">
</input>
<button>
...
</button>
</div>
</body>
<script>
// Create a new YUI instance and populate it with the required modules.
YUI({
filter: 'RAW'
}).use(['autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', 'event-outside'], function(Y) {
var ac = new Y.AutoCompleteList({
inputNode: '.combo input',
source: ['friends', 'Romans', 'countrymen', 'bla', 'blub', 'blablub'],
render: true,
minQueryLength: 0,
tabSelect: true,
activateFirstItem: true
});
Y.one('.combo button').on('click', function(e) {
console.log(ac);
e.stopPropagation();
if (ac.get('visible')) {
ac.hide();
} else {
ac.sendRequest();
ac.show();
}
});
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment