onChange in YUI
问题 How we can write code for onChange function in YUI 2 and YUI3. jQuery(':input[type=radio]').change(function(){ var aType=jQuery(this).val(); var numT= aType==1 ? "3" : "6" ; var aWidth=aType==1 ? "330px" : "660px" ; }); 回答1: In YUI 3 Y.all('input[type=radio]').each(function (node) { node.on('change', function () { var val = this.get('value'); ... }); }); // or Y.all('input[type=radio]').on('change', function (e) { var val = e.currentTarget.get('value'); ... }); In YUI 2.9 (which is no longer