Skip to content

Instantly share code, notes, and snippets.

@chrisgeo
Created September 19, 2010 17:55
Show Gist options
  • Save chrisgeo/586971 to your computer and use it in GitHub Desktop.
Save chrisgeo/586971 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head></head>
<body>
<form id="myform" name="myform">
<input type="radio" name="rad" value="foo" />
<input type="radio" name="rad" value="bar" />
</form>
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.2.0/build/yui/yui-min.js"></script>
<script type="text/javascript">
YUI({
filter: 'debug',
charset: 'utf-8'
}).use('selector-css', 'node', 'event-simulate', function(Y){
var radios = Y.all('form[name=myform] input[name=rad]');
radios.on('click', function(e){
console.log(e);
console.log('fired');
});
console.log(radios.item(1));
//doesn't fire
radios.item(1).simulate('click');
//does
//radios.item(1)._node.click();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment