Skip to content

Instantly share code, notes, and snippets.

@foxxtrot
Created July 22, 2009 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxxtrot/152139 to your computer and use it in GitHub Desktop.
Save foxxtrot/152139 to your computer and use it in GitHub Desktop.
<html>
<head><title>Event Delegation Test</title></head>
<body>
<form id="frm">
<select name="sel1" type="select">
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
<option>Value 4</option>
</select>
<select name="sel2" type="select">
<option>ABC</option>
<option>Easy as</option>
<option>123</option>
</select>
</form>
</body>
<script src="http://yui.yahooapis.com/3.0.0b1/build/yui/yui-min.js" type="text/javascript"></script>
<script type="text/javascript">
YUI().use('node', function(Y) {
var formElement = Y.get('#frm');
var formChanged = function(e) {
Y.log("currentTarget: " + e.currentTarget);
Y.log("target: " + e.target);
Y.log("container: " + e.container);
};
Y.on('delegate', formChanged, formElement, 'change', 'input');
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment