new-plugin.html revision 24aaf0b4d22c472436e8e4dacb18620adce3e1a4
<!DOCTYPE HTML>
<html>
<body class='yui3-skin-sam'>
<button id="my-button">my button</button>
<script type="text/javascript">
YUI({
filter: 'raw'
}).use('button-plugin', function(Y) {
var ButtonFactory = Y.Plugin.Button.createNode;
var button = ButtonFactory('#my-button', {
disabled: false
});
console.log(button.get('label'));
console.log(button.get('disabled'));
button.on('click', function(){
button.set('disabled', true);
console.log(button.get('disabled'));
button.set('label', 'disabled');
console.log('a');
});
/*-----*/
var button2 = ButtonFactory({label: 'foo'});
Y.augment(button2, Y.AttributeCore);
button2.on('disabledChange', function(e) {
});
button2.appendTo('body');
button2.on('click', function(){
console.log('b');
});
});
</script>
</body>
</html>