Javascript ButtonGroup

Invoke the getSelection method of the jqxButtonGroup. Author: http://jqwidgets.com

by musicreader

HTML

<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<div id='jqxButtonGroup'>
    <button style="padding:4px 16px;" id="Left">Left</button>
    <button style="padding:4px 16px;" id="Center">Center</button>
    <button style="padding:4px 16px;" id="Right">Right</button>
</div>

JavaScript

$('#jqxButtonGroup').jqxButtonGroup({
    theme: 'energyblue',
    mode: 'radio'
});
// get the selected button when it is clicked.
$('#jqxButtonGroup').on('buttonclick', function () {
    var selection = $('#jqxButtonGroup').jqxButtonGroup('getSelection');
    alert($('#jqxButtonGroup')[0].children[selection].id);
});