The attribute value of a content attribute set on an HTML element is the value that the attribute gets after being parsed and computed according to specifications. It may differ from the value that is actually written in the HTML code due to trimming whitespace or non-digits characters, default values, or case-insensitivity.
Some notable case of attribute value, among others:
- For enumerated attributes, the attribute value is either the state of the attribute, or the keyword that maps to it; even for the default states. Thus
<input type="image" />has an attribute value of either
Image Button(the state) or
image(the keyword mapping to it), both formulations having the same meaning; similarly, "an input element with a
typeattribute value of
Text" can be either
<input type="text" />,
<input />(missing value default), or
<input type="invalid" />(invalid value default).
- For boolean attributes, the attribute value is
truewhen the attribute is present and
<button disabled="">all have a
disabledattribute value of
- For attributes whose value is used in a case-insensitive context, the attribute value is the lowercase version of the value written in the HTML code.
- For attributes that accept numbers, the attribute value is the result of parsing the value written in the HTML code according to the rules for parsing this kind of number.
- For attributes that accept sets of tokens, whether space separated or comma separated, the attribute value is the set of tokens obtained after parsing the set and, depending on the case, converting its items to lowercase (if the set is used in a case-insensitive context).
aria-*attributes, the attribute value is computed as indicated in the WAI-ARIA specification.
This list is not exhaustive, and only serves as an illustration for some of the most common cases.