switchery icon indicating copy to clipboard operation
switchery copied to clipboard

Having error while disabling switcher with jquery

Open amueed opened this issue 9 years ago • 3 comments

HTML:

<input type="checkbox" class="js-switch" onchange="SetRemindme(this.checked);" id="remindmebtn">

jQuery:

var chkReminder = $("#remindmebtn"); var switchReminder = new Switchery(chkReminder); switchReminder.disable();

Plugin:

Switchery.prototype.disable = function () { debugger; if (!this.options.disabled) this.options.disabled = true; if (!this.element.disabled) this.element.disabled = true; if (!this.element.readOnly) this.element.readOnly = true; this.switcher.style.opacity = this.options.disabledOpacity; this.destroy(); };

this line this.switcher.style.opacity = this.options.disabledOpacity; shows error in google chrome console : Uncaught TypeError: Cannot read property 'style' of undefined

Please take a look at this issue.

Thanks.

amueed avatar Jul 11 '16 07:07 amueed

I have the same problem

oddtwelve avatar Oct 31 '16 17:10 oddtwelve

Update your apps to 0.8.2 and LMK if that problem still persists. Thanks.

abpetkov avatar Oct 31 '16 22:10 abpetkov

Hi. I'm having the same problem when I'm using the function setPosition to return the switch to the "checked" position. var switchry = new Switchery(input, { size: 'small' }); switchry.setPosition(true);

Where input is a var who receives the element var input = $(el);. The console is showing this error: Uncaught TypeError: Cannot read property 'style' of undefined at Switchery.setPosition (switchery.js:1699)

I just downloaded the new version of the code.

Thank you so very much.

SammDev1 avatar Jun 12 '17 17:06 SammDev1