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

12th May 2020, 5:49 PM
Shubham Thakur
Shubham Thakur - avatar
4 ответов
+ 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
12th May 2020, 9:21 PM
ODLNT
ODLNT - avatar
+ 2
12th May 2020, 7:29 PM
Tomáš Wróbel
Tomáš Wróbel - avatar
+ 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"; } });
12th May 2020, 8:03 PM
JaScript
JaScript - avatar
0
Not getting it.
12th May 2020, 7:06 PM
Shubham Thakur
Shubham Thakur - avatar