jquery - How to changing css on bootstrap button Group -
the below code toggles button in group. i'm having fun tying change css of these buttons, in particular selected button.
<span class="label label-primary">age</span> <div class="btn-group" id="ageid"> <button type="button" style="width:120px" class="btnmyage btn-default" id="3">under 10</button> <button type="button" style="width:120px" class="btnmyage btn-default" id="1">under 50</button> <button type="button" style="width:120px" class="btnmyage btn-default" id="2">over 50</button> </div> <script> $(".btn-group > .btnmyage").click(function () { $(this).addclass("active").siblings().removeclass("active"); }) </script>
my custom css file:
.btnmyage, .btn:active { background-color: #ffe13a; }
change css to
.active { background-color: #ffe13a; }
or else background-color
applied buttons because of btnmyage
class.
Comments
Post a Comment