Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 287
ParisNakitaKejser Avatar asked Mar 05 '12 16:03

ParisNakitaKejser


1 Answers

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()
like image 67
Josh Metcalfe Avatar answered Sep 19 '22 14:09

Josh Metcalfe