Active button javascript | Sololearn: Learn to code for FREE!

0

Active button javascript

Hello friends...I have created a little quiz in which I have added 3 questions with 4 button each ..I want whenever someone click on any button it will change to grey ..so it shows that it is selected.and also tried but failed please help https://code.sololearn.com/WqIE9mKl859H/?ref=app

5/12/2020 5:49:01 PM

Shubham Thakur

4 Answers

New Answer

+4

You are missing 6 closing div tags, that are causing you some problems. Such as not displaying quiz cards one at a time the way you want, and all of the answer buttons becoming gray after one click. You really need to add the closing div tags

+2

https://code.sololearn.com/W52NQIi2NaXr/?ref=app Only next buttons are not good

+2

There can be used for example such as following function for selecting buttons. Unfortunatelly the code need to be corrected for right functioning. document.body.addEventListener("click", event => { if (event.target.nodeName == "BUTTON") event.target.style.border = "4px white solid"; } });

0

Not getting it.