Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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;
    }
    nextQ.classList.remove('hidden');
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can handle this with simple CSS:

button:disabled {
  color: initial;
}
<button disabled>Button</button>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading