'What to change the button color when clicked and hide when other one is clicked

These Buttons are from the single html field

function fn2() {
  if (document.querySelectorAll('#button_input').clicked) {
    document.querySelectorAll('#button_input').style.backgroundColor = "blue";
  }
}
<button id="button_input" onclick=" fn2()">
  <input class="quiz-panel-input" type="radio" name="{{ q_identifier }}" id="{{ a_identifier }}" value="{{ a_identifier }}" data-answer-trigger>
  <label class="quiz-panel-label" for="{{ a_identifier }}">{{ answer }}</label>
</button>


Solution 1:[1]

Maybe this is what you want?

function fn2() {
  document.querySelector("button").style.backgroundColor = "blue";
}
<button id="button_input" onclick="fn2()">
  <input class="quiz-panel-input" type="radio" name="{{ q_identifier }}" id="{{ a_identifier }}" value="{{ a_identifier }}" data-answer-trigger>
  <label class="quiz-panel-label" for="{{ a_identifier }}">{{ answer }}</label>
</button>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1