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

Changing checked state via javascript doesn't update the label #35

Open
bit5 opened this issue Jan 10, 2018 · 1 comment
Open

Changing checked state via javascript doesn't update the label #35

bit5 opened this issue Jan 10, 2018 · 1 comment

Comments

@bit5
Copy link

bit5 commented Jan 10, 2018

When changing the state of the checkbox using jquery script, the checkbox doesn't switch visually.

Look at this code
<input id="chk" type="checkbox") />
$('#chk').checkboxpicker();
$('#chk').prop('checked', false).trigger('change');

You will see the checkbox does not switch/toggle.
Any idea how to fix it?

Cheers,
Bit5

@bit5
Copy link
Author

bit5 commented Jan 10, 2018

This is similar with issue #34.

The problem is that I am using "trigger" to ensure the "change event" is raised.
For quick workaround, I need to set the checked value to opposite value and then back to the actual value.

For example, the real value is FALSE, then do this:
$('#chk').prop('checked', true);
$('#chk').prop('checked', false);

As you can see, I've set the checked value to TRUE then set it back to FALSE.

I hope this help someone :)

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