Reputation: 128
I am trying to use Bootstrap 3 radio buttons. Things seem to be working fine, other than the input
elements are never selected.
I found that the click.bs.button.data-api
event is triggered once, and that calls $btn.button('toggle')
only once. However, $.fn.button
is somehow triggered twice. As a result, Button.prototype.toggle
correctly sets the input to its selected state and then deselects it.
Why may $.fn.button
be run twice?
Upvotes: 1
Views: 570
Reputation: 128
After I tried to reproduce the issue on JS Fiddle, I was able to identify the source of the issue.
This was an application that I was updating from Bootstrap 2 to Bootstrap 3. There was a big JS libraries file that contained Bootstrap 2. Running that one along with Bootstrap 3 caused the toggle
method to be run twice, thus invalidating the selection.
The error went away after removing all of the Bootstrap 2 code.
Upvotes: 2