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

disabled still toggable #21

Open
gvdhoven opened this issue May 4, 2016 · 0 comments
Open

disabled still toggable #21

gvdhoven opened this issue May 4, 2016 · 0 comments

Comments

@gvdhoven
Copy link

gvdhoven commented May 4, 2016

It looks like a checkbox, converted to a 'checkboxpicker' can still be changed even though it has been set to readonly. The state of the button changes to dimmed (e.g. disabled) but i can still click on it and it updates the state of the checkbox.

Changing this:

click: function(event) {
  // Strictly event.currentTarget. Fix #19
  var $button = $(event.currentTarget);

  if (!$button.hasClass('active') || this.options.switchAlways) {
    this.change();
  }
}

To this fixed the issue:

click: function(event) {
  // Strictly event.currentTarget. Fix #19
  var $button = $(event.currentTarget);

  if ($button.hasClass('disabled')) {
    return;
  }

  if (!$button.hasClass('active') || this.options.switchAlways) {
    this.change();
  }
},
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