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

how to set the state on .ready?

Open StepIg opened this issue 5 years ago • 3 comments

I need to set the state. the checked value in html doesnt work and also how to change the state after loading a page? thanks in advance

StepIg avatar May 18 '19 09:05 StepIg

I just noticed this as well when updating to 3.4 from 3.3.4. Even though I have 'checked' or 'unchecked' specified in the html for each input this new version doesn't respect them at all. This worked perfectly fine with version 3.3.4.

Do we have to manually set the check state in js for every input now? If so, that is a pretty dumb change.

morrow95 avatar Jun 03 '19 19:06 morrow95

Hi,

Same here, it works on 3.3.5 but not on 3.4 branch using AngularJS.

@StepIg have you set the on or off text ? When I use default value on these fields, I don't have the bug, can you confirm ?

Nicolas

nitrique avatar Jun 05 '19 10:06 nitrique

Hi, Is the problem fixed yet? I still cannot create and show the switch in the ON state.

sample code: let whatever_toggle = $(<input type="checkbox" name="whatever-toggle" class='whatever_toggle'></input>); $(parent_elem).append(whatever_toggle); // .... $(".whatever_toggle").bootstrapSwitch({
state: true, // size: null,
size: 'mini',
// animate: true, onColor: 'primary', offColor: 'danger' // ..... }); i tried the defaults in: size, onColor , offColor but still remains [OFF] ..

btw, i'm using CDN links to BOOTSTRAP 4.3.1 and to jquery-3.4.1.min.js

avits1 avatar Aug 20 '19 15:08 avits1