bootstrap-checkbox icon indicating copy to clipboard operation
bootstrap-checkbox copied to clipboard

disabled still toggable

Open gvdhoven opened this issue 9 years ago • 0 comments

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();
  }
},

gvdhoven avatar May 04 '16 11:05 gvdhoven