Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 data-toggle buttons-radio

It seems buttons-radio no longer works in Bootstrap 3

<div class="btn-group" data-toggle="buttons-radio">
    <button class="btn btn-default" value="1" type="button" >1</button>
    <button class="btn btn-default" "value="2" type="button" >2</button>
</div>

It has been replaced with radio button inputs. Is there any way to bring back the only one button allowed to be checked in a group with buttons? I need to be able to have the group be totally unpicked after one item has been selected so radio buttons won't do.

This ended up being the answer for me to keep using buttons in a radio type in BS3:

$(this).addClass("current").siblings().removeClass("active");

like image 308
Rich P Avatar asked Aug 21 '13 01:08

Rich P


People also ask

Are radio buttons rendered as Bootstrap Data- toggle=buttons?

Radio buttons rendered as bootstrap data-toggle=buttons, MVC validation fails 0 Bootstrap Changing the active radiobutton CSS when clicked 0 Jquery plugin compatibility for Bootstrap radio buttons and toggle button

How do I toggle a button in Bootstrap?

These are the standard bootstrap's buttons methods: $().button('toggle') This method toggles push state of the button. It changes the appearance of the button, and makes it look like that it has been activated. You can also enable auto toggling of a button by simply using the data-toggle attribute. Let's take a look at the following example:

What can you do with bootstrap?

With Bootstrap you can do even more with the buttons like controlling the states of buttons, make checkbox and radio inputs behaves like toggle buttons, and so on. In the following section we will discuss them in detail.

What is a radio button?

Radio Button: As the name suggests, it is the concept of the buttons in a radio, where for the first station, we select the first button, for the second station we select the second button and so on. It is like a multiple-choice question where at a time only one button will be active.


1 Answers

This ended up being the answer for me to keep using buttons in a radio type in BS3:

$(this).addClass("current").siblings().removeClass("active");
like image 133
Rich P Avatar answered Sep 20 '22 12:09

Rich P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!