How to change a button's colour persistently in CSS or jQuery
I have buttons that I want to turn blue after being pressed:
$(document).ready(function() {
$("button.btn.btn-default").on('click', function() {
$(this).toggleClass('active');
});
});
.active {
background-color: #0F89BE;
}
I have multiple buttons and I want the selected button to turn blue (active). Similar to a radio button. Is there a simpler way to accomplish this? The jQuery doesn't work for me, I'm not sure what I'm doing wrong.