How to show or hide divs based on radio button list selection? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to show or hide divs based on radio button list selection?

19th Nov 2021, 10:58 AM
Prof Freelancer
5 Answers
19th Nov 2021, 11:21 AM
A͢J
A͢J - avatar
+ 1
Can it be used to show and hide multiple divs?
19th Nov 2021, 11:23 AM
Prof Freelancer
+ 1
Prof Freelancer Yes it can be but all divs should have same class. I have used id because of single div but you can use class for multiple divs
19th Nov 2021, 12:03 PM
A͢J
A͢J - avatar
0
I want more than two radio buttons with multiple divs and when I click a radio button it shows one of the divs then when I click another radio button it shows a different div and so on
19th Nov 2021, 1:09 PM
Prof Freelancer
0
Prof Freelancer Then you have to create buttons and divs using JavaScript and give dynamic classes on button and div and using click event you can hide and show div based on button.
19th Nov 2021, 3:14 PM
A͢J
A͢J - avatar