mdbootstrap / bootstrap-toggle-buttons

Bootstrap-toggle-buttons has moved to https://github.com/nostalgiaz/bootstrap-switch
https://github.com/nostalgiaz/bootstrap-switch
Apache License 2.0
1.02k stars 92 forks source link

toggleButtons can only be called after inserting the checkbox into DOM #35

Open KidkArolis opened 11 years ago

KidkArolis commented 11 years ago

I see $('.toggle-button') selector is used in the code, which means, that if the toggleButtons was called on a checkbox that's not yet inserted into DOM, it won't attach any event listeners.

KidkArolis commented 11 years ago

What about doing smth like this instead?

$element.closest(".toggle-button")
oskarols commented 11 years ago

+1, this matter a lot when using it with frameworks like backbone.

jessebsmith commented 11 years ago

+1, I'm unable to get this to work with some knockoutjs when I use data-binds. More specifically with use of the "with" binding.

nostalgiaz commented 11 years ago

I like this idea. Can you send me a pull request?