How do I make an input/text field mandatory(required) when the radio button assigned to it is checked/selected?
I need an input field to become mandatory once the corresponding radio button is selected:
Radio Button 1 Text Field 1
Radio Button 2 Text Field 2
Radio Button 3 Text Field 3
So if Radio button 1 is selected, I need Text Field 1 to become mandatory. If Radio button 2 is selected, I need Text Field 2 to become mandatory and so on.
See the actual code below:
Please confirm your identity by selecting/using one of the below Government issued identification. Upon selecting an identity type, please fill in the text field next to it.
<TR>
<TD width="253"><input type="radio" required name="IdentityType" id="IdentityType" value="Australian driver's licence number">
<label for="IdentityType">**Australian driver's licence number:**</label>
</TD>
<TD width="672">
<span id="sprytextfield1">
<input name="IdentityValue" type="text" id="IdentityValue" value="" />
</span>
</TD>
</TR>
<TR>
<TD style="text-indent:22px">
<label for="IdentityType">**Issue state or territory:**</label>
</TD>
<TD>
<input name="IdentityValue" type="text" id="IdentityValue" value="" />
</TD>
</TR>
<TR>
<TD>
<input type="radio" required name="IdentityType" id="IdentityType" value="Australian passport number">
<label for="IdentityType">**Australian passport number:**</label>
</TD>
<TD>
<input name="IdentityValue" type="text" id="IdentityValue" value="" />
</TD>
</TR>
<TR>
<TD>
<input type="radio" required name="IdentityType" id="IdentityType" value="Immicard number">
<label for="IdentityType">**Immicard number:** </label>
</TD>
</TR>