JavaScript SwitchButton

Set the checked property of the jqxSwitchButton. Author: http://jqwidgets.com

HTML

<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<div id="jqxSwitchButton"></div>
<br />
<button id="changeState">Change state</button>

JavaScript

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

var state = false;
$("#changeState").click(function () {
    $("#jqxSwitchButton").jqxSwitchButton({
        checked: state
    });
});