Radio Button Validation3. Button Labels |
|
Join the DiscussionMore of this FeatureIn order for the person filling out the form to have some idea of what each button in our radio button group does we need to provide descriptions for each button. The simplest way to do this is to provide a descriotion as text immediately following the button. There are a couple of problems though with just using plain text.
Here is what the complete HTML for one of the buttons on our example form looks like:
<label for="r1"><input
type="radio"
name="group1" id="r1" value="1" /> button one</label> As the radio button with the id referred to in the for parameter of the label tag is actually contained within the tag itself, the for and id parameters are redundant in some browsers. There are browsers however that are not smart enough to recognise the nesting that will function correctly if these parameters are included so it is worth putting them in so as to maximize the number of browsers on which this code will function. That completes the coding of the radio buttons themselves. The final step is to set up radio button validation using Javascript. |

