All form controls should have text labels adjacent to them. All form elements should have labels associated with them in the markup (i.e. ID and FOR elements). Use the LABEL element to programmatically associated prompts with input elements when the text prompt and the control are separated. Keep in mind that dynamic HTML scripting of the form does not interface with assistive technologies.
Method:
Use the “label” and “id” attributes within the FORM tag to identify form elements.
Label and ID in Textboxes or Selects
<FORM> <LABEL FOR="first"> FIRST NAME:</LABEL>
<INPUT TYPE="TEXT" NAME="FIRSTNAME" ID="first“>
<LABEL FOR=“state"> State</LABEL>
<SELECT NAME=“state"ID=“state”></select>
<INPUT TYPE="SUBMIT" VALUE="SUBMIT">
</FORM>
Label and ID in Checkboxes or Radio Buttons
1. Gender:
<INPUT TYPE=“RADIO" value=“M” NAME=“gender" ID=“1a“> <LABEL FOR=“1a">Male</LABEL>
<INPUT TYPE=“RADIO" value=“F” NAME=“gender" ID=“1b“> <LABEL FOR=“1b">Female</LABEL>