I've been tasked with working on a front-end project for a website that involves buttons changing color when clicked and staying that color.
Here is the CSS <style>
code I have written for these specific buttons:
.button {
background-color: #ffffff;
border: 1px solid #3e1313;
color: #3e1313;
padding: 10px;
text-align: center;
text-decoration: none;
font-size: 12px;
margin: 4px 2px;
}
button:hover{background-color:orange;}
.button4 {border-radius: 10px;}
HyperText:
<div class="row">
<div class="columnExpand">
<label class="container" name="lblDriverExperience">
Driver Experience
<input type="checkbox" name="chkDriverExperience"
onchange="divToggle('divDriver')">
<span class="checkmark"></span>
</label>
</div>
<div class="columnOption" id="divDriver">
<button class="button button4">Good</button>
<button class="button button4">Fair</button>
<button class="button button4">Poor</button>
</div>
</div>
JAVASCRIPT:
<script type="text/javascript>
$("#test").click(function() {$(this).toggleClass( "active")})
</script>
While the button currently turns brown on hover, my goal is to make it turn green when clicked and stay green. I've searched for solutions but haven't found one that works.