ParisNakitaKejser
ParisNakitaKejser

Reputation: 14859

Define value in btn-group using twitter-bootstrap

I have a problem when using bootstrap in my code. I want the value from my btn-radio, but I cannot find out how to do it.

<label>Status</label>
<div class="btn-group" id="filterProductStatus" data-toggle="buttons-radio">
<button class="btn active">All</button>
<button class="btn">Online</button>
<button class="btn">Offline</button>
</div>

I want to get the value of the preset button and later the selected button; can someonne help me?

Upvotes: 6

Views: 6651

Answers (2)

Josh Metcalfe
Josh Metcalfe

Reputation: 2175

The accepted answer won't work as you need to select a child button, not the part div. I think you'll find this works:

$('#filterProductStatus > button.active').text()

Upvotes: 16

ParisNakitaKejser
ParisNakitaKejser

Reputation: 14859

I completed this question myself by using ( $('#filterProductStatus.active').val() ). This has help me to do what I needed to do.

Upvotes: 2

Related Questions