I am trying to change the color of the button on click . I am doing it on the Bootstrap button which is blue. But my code is not working.
With my JavaScript code following, it is not changing the color.
<button type="button" id="btnOUs" class="btn btn-primary" ng-click="levelOU()">Organization Units </button>
</button>
<button type="button" id="btnchiefdom" class="btn btn-primary" ng-click="levelCD()">Chiefdom</button>
</button>
<button type="button" id="btndistrict" class="btn btn-primary" ng-click="levelD()">District </button>
</button>
<button type="button" id="btnfaciltiy" class="btn btn-primary" ng-click="levelF()">Facility </button>
</button>
Here is the javascript code:
var b1 = document.getElementById("btnOUS");
var b2 = document.getElementById("btnchiefdom");
var b2 = document.getElementById("btndistrict");
var b2 = document.getElementById("btnfacility");
b1.onclick = function() {
b1.style.background = "green";
b2.style.background = "";
}
b2.onclick = function() {
b1.style.background = "";
b2.style.background = "green";
}
b2.onclick = function() {
b1.style.background = "";
b2.style.background = "green";
}
b2.onclick = function() {
b1.style.background = "";
b2.style.background = "green";
}