i want to disable switchery but failed i did try difrent code from here this code doesn't work for me
var elem = document.querySelector('.js-dynamic-state');
var switchery = new Switchery(elem);
document.querySelector('.js-dynamic-disable').addEventListener('click', function() {
switchery.disable();
});
document.querySelector('.js-dynamic-enable').addEventListener('click', function() {
switchery.enable();
});
on creating new switchry it can be set disable but in other event it doesn't work switchery.disable();
it displays error in console
disable is not function
i also did try this which generates new switchery
var switchery = new Switchery(elem, { disabled: true });
when i use the above given code completely in that event it generates new switchery button.
any help!
var elem = document.querySelector('.js-switch');
var init = new Switchery(elem);
init.disable();
init.enable();
Use the above code to disable() function the disable the element. or enable() function to enable the element.