简体   繁体   中英

rails-bootstrap-toggle-buttons in simple_form bootstrap not working

please forgive my newbieness here - I am trying to get the gem rails-bootstrap-toggle-buttons to work in the rails app. I searched all over and can't figured it out. I have tried wrappers, but can't get it to work. Any help would be appreciated!!

link to gem: https://github.com/caarlos0/rails-bootstrap-toggle-buttons

link to gem source: https://github.com/nostalgiaz/bootstrap-switch

I am trying to produce this:

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

the code works great in the site but when I try to add it to simple_form then it goes down hill.

using Simple_forms :

= f.input :home_address

I had added :id=>"checkbox" and I have read the docs on the gem's site but I am very new at this and after 4 hours I am still not getting it Thanks!

Notice that you must have the <div> with the data attributes on your code. If you are putting just plain old simple_form code like f.input , it would just create the input, and not the wrapping <div> that carries the important stuff.

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