Hi,
I’m creating a form from scratch using radiobuttons, where the user answers some questions. Based on what the user answers, other relevant questions are expanded on the site.
For now all the radiobuttons are set to NOT required, as the user only needs to see the questions relevant to his/her’s previous answer.
I am trying to write some code that changes the “required field” to be true/false, if an other radio button is checked.
I’ve created an example in the image below:
If the user answers YES whether he/she has a favourite colour, I want the input below to be a required field.
If he/she answers NO, I want to make the question below to NOT be required.
I’m new to coding. Any help is highly appreciated!
Thank you.
Marte