I’m learning html and for a project I’m making a survey form. I want a dropdown menu that when the user selects yes it has new question pop up relating to the subject. How would i do this? I have no knowledge of JavaScript.
Do you own the DLC?
`(select one)
Yes
No
What i want is when someone selects yes other questions will now show relating to the dlc. Will this be possible with only html and css?
3
Answers
No, it won’t be possible without JS, since you have to handle a logic (You have to add an input based on a value, do you see the logic here?). Hence, explore Javascript and it should be fairly straightforward for you to develop. Comment on this thread if you want some help and you are stuck.
Here you go:
Explanation:
choice
invisible
class to easily hide elements by adding this class or showing elements by removing itIn CSS you can create a next sibling selector rule with pseudo-selectors, but unless you are okay by holding the click button, I advise against it in this case.
You can do by validating option value selected for the siblings.
For this HTML structure should have the select dropdown and the questions elements/HTML tags on same level, as in they should be siblings.
Check below:
Hope this helps, using JUST CSS.