I want to select one option and disable rest options. I am not able to do that. Can anybody help me with this?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I want to select one option and disable rest options. I am not able to do that. Can anybody help me with this??

https://code.sololearn.com/W7Jm487Gfc1U/?ref=app

16th May 2020, 1:46 PM
Jagmeet Singh
Jagmeet Singh - avatar
10 Answers
16th May 2020, 4:53 PM
Russ
Russ - avatar
+ 3
Sebastian Pacurar It could just be that he's fairly new to this and hadn't realised there was another way. His profile suggests he's only been learning for a month or so, so I think we should cover all options when trying to help ๐Ÿ˜‰
16th May 2020, 3:57 PM
Russ
Russ - avatar
+ 2
to disable click event over any element you can use pointer-events property in your css file. like this: .disabled-class { pointer-events: none; } make sure the elements which don't match the right answer to have that class (disabled-class)
16th May 2020, 2:03 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 2
I'm not sure I understand your question fully, but are you aware of the element attribute "disabled"? To disable a button (for example), you can do "button.disabled = true;".
16th May 2020, 3:44 PM
Russ
Russ - avatar
+ 2
Russ i was thinking about the same thing but he used divs instead of buttons
16th May 2020, 3:46 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 2
Russ i totally agree ๐Ÿ‘๐Ÿ˜€
16th May 2020, 4:00 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 1
Thank you Russ for explaining me with an example๐Ÿ‘ i will implement it in my practice JavaScript program
16th May 2020, 5:12 PM
Jagmeet Singh
Jagmeet Singh - avatar
+ 1
No worries, good luck and happy coding!
16th May 2020, 5:15 PM
Russ
Russ - avatar
+ 1
Thank you Sebastian Pacurar for giving an idea to implement pointer-event in css
16th May 2020, 5:15 PM
Jagmeet Singh
Jagmeet Singh - avatar
+ 1
Yes Russ well said, i want to change my domain and totally wants to get involve in web development. Hence just started learning a month back. Thanks for your support.
16th May 2020, 5:20 PM
Jagmeet Singh
Jagmeet Singh - avatar