Created
July 22, 2009 17:08
-
-
Save foxxtrot/152139 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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