I have created two buttons in HTML and I have written some jQuery so that when the user clicks one of the button, a new CSS rule will be applied to that button. This code works below:
$('#approve').on('click', function(){
$('#approve:hover').css("background-color", "#24ce3a")
$('#approve:hover').css("color","#FFF")
});
$('#reject').on('click', function(){
$('#reject:hover').css("background-color", "#e32e10")
$('#reject:hover').css("color", "#FFF")
});
If #approve
is clicked, I want to give it a new color and disable the #reject
button. The next time #approve
is clicked, I want to reset to the original styling, and re-enable the #reject
button. The #reject
button should have similar behavior: toggle it's own state when clicked, and disable the #approve
button while it's active.
Any ideas how I can accomplish this?