I’m making a form and would like text input field to be inside of a radio/checkbox input field. What is the right way to do it?
<form>
Question 1:
<label for="Q01_A01"><input name="Q01" id="Q01_A01" type="radio" value="Q01_A01" />Yes </label>
<label for="Q01_A02"><input name="Q01" id="Q01_A02" type="radio" value="Q01_A02" />No, why? ...TEXT FIELD HERE.....</label>
<label for="Q01_A03"><input name="Q01" id="Q01_A03" type="radio" value="Q01_A03" />I don't know </label>
</form>
I’m not sure if this is necessary but I think it would look good if someone selects ‘No’ option, the text field appears – otherwise it’s hidden. If there’s an easy way to do it with jQuery, I’d be happy to use it.
Here’s how you could do it in a more general sense: http://jsfiddle.net/mYZaQ/62/
There are a few things that have to be consistent about the form though:
labelwhymoreradiobutton named
whyHTML:
…and the jquery: