This section covers how to use HTML code to make forms in web pages accessible. Follow the following steps to define a label for any form field element such as radio buttons, text boxes, or check boxes. Compare the steps with the example code below for the formatting of the HTML code to apply these changes to your specific page.
- Ensure that each form field has a unique id attribute. If it does not have one, add a unique ID after the <FORM tag before the > and with spaces on both sides of the attribute.
- Ensure that there is a text description for each form field.
- Add the <label for=""> and </label> tags with the ID of the corresponding form field inserted between quotes in the for="" portion of the label tag.
The form fields have been correctly defined.
<FORM action="FMPro" method="post">
<label for="first">First Name:</label>
<input id="first" name="firstname" type="text">
<label for="last">Last Name:</label>
<input id="last" name="lastname" type="text">
<input type="submit" value="Submit" name="Submit">
<input type="reset" value="Clear" name="Clear">