• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Forms > Labeling Input Fields

Labeling Input Fields

As noted earlier in the chapter, it's up to you as a form author to include prompting text in front of your form fields to suggest to a user how he or she should fill in the field. The XHTML <label> element formalizes the relationship between the prompting text (the label) and the form field it is paired with. <label> takes the for attribute, where for is set equal to the id attribute value of the associated form field. In the example

<label for="Zip">Enter your 9-digit ZIP code: </label>
<input type="text" name="ZipCode" id="Zip" />


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint