Here's an example plugin approach, http://tivac.com/yui3/so/skladjfyhafjk_autocomplete.htm
Just pass event handlers as part of the configuration when you first connect autocomplete to the input.
Y.one("#ac").plug(Y.Plugin.AutoComplete, { resultHighlighter: 'phraseMatch', source: ['foo', 'bar', 'baz'], on : { select : function(e) { console.log(arguments);
You can also subscribe after an element has been connected using the namespace to which it is attached ("ac").
Y.one("#ac").ac.on("select", function() { console.log("post-plugin event subscription");
If you use it as a class, it works as follows.
var ac = new Y.AutoComplete({ inputNode: '#ac', source: ['foo', 'bar', 'baz'] }); ac.on("select", function() { console.log("Class event subscription");
Tivac
source share