new-group.html revision 24aaf0b4d22c472436e8e4dacb18620adce3e1a4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ButtonGroup Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="/build/cssreset/reset-min.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="/build/yui/yui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
YUI({
debug: true,
filter:"raw"
}).use('button-group', function(Y) {
var PushGroup = new Y.ButtonGroup({
srcNode : '#pushGroup',
type : 'push'
}).render();
var CheckboxGroup = new Y.ButtonGroup({
srcNode : '#checkboxGroup',
type : 'checkbox'
}).render();
var RadioGroup = new Y.ButtonGroup({
srcNode : '#radioGroup',
type : 'radio'
}).render();
PushGroup.on('press', function(e){
console.log(e.details[0].target.getContent());
});
CheckboxGroup.on('selectionChange', function(e){
console.log(this.getSelectedValues());
console.log('CheckboxGroup - selectionChange');
});
RadioGroup.on('selectionChange', function(e){
console.log(this.getSelectedButtons()[0].get('label'));
console.log('Radio - selectionChange');
});
});
</script>
</head>
<body class='yui3-skin-sam'>
<div id="pushGroup">
<p>Push</p>
<button>A</button>
<button>B</button>
<button>C</button>
</div>
<hr>
<div id="checkboxGroup">
<p>Checkbox</p>
<button>A</button>
<button>B</button>
<button>C</button>
</div>
<hr>
<div id="radioGroup">
<p>Radio</p>
<button>A</button>
<button>B</button>
<button>C</button>
</div>
</body>
</html>