Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change active color of bootstrap button group to have different color for each button

When I press the No button I want it to turn red. I want the Yes button to behave the way it already does ie. limegreen when active. How do I do this?

Please see my fiddle

html

<div class="col-sm-5 btn-group" data-toggle="buttons">
    <label class="btn btn-info">
        <input checked="checked" name="media_release" value="1" type="radio"> Yes
    </label>
    <label class="btn btn-info active">
        <input name="media_release" value="0" type="radio"> No
    </label>
</div>

css

.btn-info.active {
    background-color: limegreen;
}
like image 902
Phil Avatar asked Mar 05 '15 16:03

Phil


1 Answers

.btn-info.active {
    background-color: limegreen;
}

.btn_red.active {
    background-color: red;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="col-sm-5 btn-group" data-toggle="buttons">
    <label class="btn btn-info">
        <input checked="checked" name="media_release" value="1" type="radio"> Yes
    </label>
    <label class="btn btn-info btn_red">
        <input name="media_release" value="0" type="radio"> No
    </label>
</div>
like image 197
kadam sunil Avatar answered Nov 12 '22 05:11

kadam sunil