简体   繁体   中英

Bootstrap switch doesn´t works

I am starting with Bootstrap switch.

I have used the demos from http://www.jque.re/plugins/version3/bootstrap.switch/

The problem is that the switch doesn´t shows. It shows only a standard checkbox.

<div class="make-switch" data-on="primary" data-off="info">
        <input type="checkbox" checked>
</div>

I also have included the css and js staff.

JSFiddle: http://jsfiddle.net/crtLwdg4/

What am I missing here?

I just added this to the fiddle and it seems the appearance has changed.

$(function() {
    $('.make-switch').bootstrapSwitch();
});

It seems you need to initialize the switch manually. I have only taken a glance at the docs but this actually changed the appearance of the checkbox.

UPDATE

I was able to get it working by adding a name property to the input and changing the jquery accordingly. see this updated fiddle .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM