I have 2 button groups on one HTML page. 3 to 4 buttons in each group (button using bootstrap). I want to use Javascript to change the color button when clicking without onclick.
- User will click any button from group 1 (when clicking change color to green) and click the button from group 2 without deselecting button from group 1.
.show {
display : block;
}
.btn-group {
margin-top : 20px;
overflow : hidden;
}
.btn {
font-weight : bold;
color : white;
border : none;
outline : none;
padding : 12px 16px;
/*blue*/
background-color : #2c75ff;
cursor : pointer;
}
.btn:hover {
font-weight : bold;
color : white;
/*green*/
background-color : #85c995;
}
<div class="row">
<div class="column" style="width:30%">
<div class="btn-group" >
<button type="button" class="btn btn-primary" style="outline-color:red; ">Sunday</button>
<button type="button" class="btn btn-primary" >Tuesday</button>
<button type="button" class="btn btn-primary" >Friday</button>
</div>
</div>
<div class="column" style="width:70%">
<div class="btn-group" >
<button type="button" class="btn btn-primary" >9 am</button>
<button type="button" class="btn btn-primary">2 pm</button>
<button type="button" class="btn btn-primary">5 pm</button>
<button type="button" class="btn btn-primary" >8 pm</button>
</div>
</div>
</div>