simple-button-source-js.mustache revision d6c63bd07b2e1b034b608fb8af3ae94e6c03ee08
YUI().use('button', function(Y){
// A basic push button
var pushButton = new Y.Button({
srcNode:'#myButton',
});
// A toggle button with a state change listener
var toggleButton = new Y.Button({
srcNode:'#myToggleButton',
type: 'toggle',
after: {
'selectedChange': function () {
var button = this;
var selected = button.get('selected');
if (selected) {
button.set('label', 'Toggle Button: Selected');
}
else {
button.set('label', 'Toggle Button: Unselected');
}
}
}
});
// A disabled button
var disabledButton = new Y.Button({
srcNode:'#myDisabledButton',
disabled: true
});
// An event button, listening for a click
var eventButton = new Y.Button({
srcNode:'#myEventButton',
});
eventButton.getNode().on('click', function(){
alert("I was clicked!");
})
// A disabled button
var selectedButton = new Y.Button({
srcNode:'#mySelectedButton',
selected: true
});
});