Closed danielh-official closed 3 years ago
$('#example').change(function () { console.log(document.getElementById('example').value); });
With this code, if I click on a checkbox initialized with this toggle,
<input type="checkbox" data-toggle="toggle" data-on="Yes" data-off="No" data-onstyle="success" data-offstyle="danger" id="example" data-size="large">
it will always yield "true" in the browser's console, regardless of whether it's "Yes" or "No".
Nevermind. I should change the code to this:
$('#example').change(function () { console.log(document.getElementById('example').checked); });
With this code, if I click on a checkbox initialized with this toggle,
<input type="checkbox" data-toggle="toggle" data-on="Yes" data-off="No" data-onstyle="success" data-offstyle="danger" id="example" data-size="large">
it will always yield "true" in the browser's console, regardless of whether it's "Yes" or "No".
Nevermind. I should change the code to this: