Disable buttons but keep style

Is there a way to disable buttons but keep the default style? Not have them greyed out? currently, the buttons are disabled correctly but are shown as greyed out. I have found a similar question however they were using jQuery and I need to use vanilla JavaScript.

function disableAnswers() {
    for (let i = 0; i < answers.length; i++) {
        answers[i].disabled = true;

>Solution :

You can handle this with simple CSS:

button:disabled {
  color: initial;
<button disabled>Button</button>

Leave a Reply