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

Removed global jQuery selectors to reduce multiple-event binding #41

Closed shmeeps closed 11 years ago

shmeeps commented 11 years ago

This commit removes the global jQuery selectors from the script. These selectors would pick up on every toggle button that existed, meaning that having multiple toggle buttons on the same page had the possibility of binding the onChange callback to it's toggle button multiple times.

This change also negates the need for e.preventDefault() and e.stopImmediatePropagation(), which allows for outside scripts to bind on the hidden checkbox's change event without affecting the functionality of the toggle buttons.