Closed alterphp closed 9 years ago
Could you explain this in a bit more detail for me please?
Sorry for this laconic message...
When a checkbox is disabled, I think the "toggle" behavior should not apply. So I guess "click" event must firstly check if the clicked input is enabled or not.
I have accounted for this on a work project, for the click side anyway. I have forked and plan to do a pull request but am going on an epic road trip so won't be able to do a pull request till next month.
This code starts on line 160 and is as simple as this:
Toggles.prototype.bindEvents = function() {
var self = this;
// evt handler for click events
var clickHandler = function(e) {
// is the toggle disabled?
if ( $(e['target']).parents(".toggle.disabled").size() > 0 ) {
e.preventDefault();
return false;
}
So this toggle will not be toggleable:
<div class="toggle disabled toggles-modern"></div>
Assign it dynamically via the .addClass()
and .removeClass()
jQuery methods.
Hi,
I'm not sure but it seems that jquery-toggles does not handle disabled checkbox input.
It might be a future enhancement...