Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value is always true #225

Closed
danielh-official opened this issue Sep 2, 2020 · 0 comments
Closed

Value is always true #225

danielh-official opened this issue Sep 2, 2020 · 0 comments

Comments

@danielh-official
Copy link

danielh-official commented Sep 2, 2020

$('#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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant