Access 12.4.1.1

From Htmlpedia
Jump to: navigation, search

Access: [12.4.1.1]: associate labels explicitly with form controls (Priority 2)

Cause:

The "for" and "id" attributes explicitly associate a label with its matching form control. The value of the "for" attribute must be identical to the "id" attribute. More than one label may be associated with the same control by creating multiple references through the "for" attribute.

Example:

Bad
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>aert1.0/12.4.1</title>
</head>
<body>
<form action="">
<label>Some text:</label>
<input value="****" type="text" />
</form>
</body>
</html>

Solution:

References: