ford
ford

Reputation: 11826

Setting checked property in Bootstrap btn-group as radio

I'm trying to use Bootstrap buttons as radio buttons as described here, under Radio. The problem is when trying to add the checked property to one of the inputs so that it comes as the default selection when the user first sees the page. I'm trying to do this like so:

<input type="radio" name="options" id="option2" checked>

Unfortunately, the button doesn't come up with the "active" state by default. As can be seen in this jsFiddle.

What am I doing wrong?

Upvotes: 0

Views: 546

Answers (1)

Renier
Renier

Reputation: 1535

You should use class="active". In twitter bootstrap, you will indicate the default value using the 'active' class

I modified your jsfiddle to use the active class

updated jsfiddle

I hope this helps.

Upvotes: 1

Related Questions