JavaScript SwitchButton

Bind to the change event by type: jqxSwitchButton. Author: http://jqwidgets.com

by mogador

HTML

<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">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<div id="jqxSwitchButton"></div>

<div id='jqxCheckBox'>Entertainment</div>

JavaScript

$('#jqxSwitchButton').jqxSwitchButton({
    height: 35,
    width: 80,
    theme: 'energyblue'
});

$("#jqxCheckBox").jqxCheckBox({
    width: '300px',
    height: 25,
    theme: 'energyblue'
});

$('#jqxCheckBox').on('change', function (event) {
    alert("change checkbox => event.args.type = " + " " + event.args.type);
});

$('#jqxSwitchButton').on('change', function (event) {
    alert("change switchbutton  => event.args.type = " + " " + event.args.type);
});

// force check
    $('#jqxSwitchButton').jqxSwitchButton('check');
    $('#jqxCheckBox').jqxCheckBox('check');