1.Give class name to the buttons
3.Get the class of the button using 'document.getElementsByClassName' and change the color of the respective button based on the selected value.
I recommend modeling 2 buttons for each option: one with the “selected” color, and other with the “unselected” color. Then use conditional visibility to show only one of the two options. So that’s 6 buttons total with 3 visible at any time.