I have two radio buttons and I would like only one to be selected at a time. The code that I am using works, but I get a warning from the validator saying:
Validation Output: 1 Warning
Below is a list of the warning message(s) produced when checking your document. Line 115, Column 26: reference to non-existent ID "addressType"
<td><label for="addressType">Address For</label></td>
This error can be triggered by:
A non-existent input, select or textarea element A missing id attribute A typographical error in the id attribute Try to check the spelling and case of the id you are referring to.
The code that I am using is:
<tr>
<td><label for="addressType">Address For</label></td>
<td><label for="homeType">Home</label>
<input type="radio" id="homeType" name="addressType" value="home" />
<label for="busType">Business</label>
<input type="radio" id="busType" name="addressType" value="business" /></td>
</开发者_Python百科tr>
What am I doing wrong?
Thank you in advance!
As the validation error indicates you should only set <label>
elements for items which have an id. That id value should then be set into the for
attribute.
精彩评论