Changing the Color of button on Click in bootstrap
See this functional example:
$("button").click(function(){
$("button").removeClass("active");
$(this).addClass("active");
});
.active {
background-color: green !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<button type="button" id="btnOUs" class="btn btn-primary" ng-click="levelOU()">Organization Unitss </button>
<button type="button" id="btnchiefdom" class="btn btn-primary" ng-click="levelCD()">Chiefdom</button>
<button type="button" id="btndistrict" class="btn btn-primary" ng-click="levelD()">District </button>
<button type="button" id="btnfaciltiy" class="btn btn-primary" ng-click="levelF()">Facility </button>
Replace "btnOUS"
by "btnOUs"
(small s
) in :
var b1 = document.getElementById("btnOUS");
_______________________________________^
Hope this helps.
Basic example :
var b1 = document.getElementById("btnOUs");
b1.onclick = function() {
b1.style.background = "green";
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<button type="button" id="btnOUs" class="btn btn-primary" ng-click="levelOU()">Organization Units </button>