html - Can the select option value be of different types? -
i want know practice select option values.
example
<select name="select"> <option value="0-9">sample</option> <option value="a-z">sample</option> <option value="this sample value">sample</option> <option value="this-is-sample-value">sample</option> <option value="this_is_sample_value">sample</option> <option value="this & | sample ** value">sample</option> </select>
i'm little bit confused here. select value same input text
, textarea
there no limits real type of data can set in value attribute of option element. characters special meaning in html do, of course, need represented appropriate entities (&
&
example (although 1 in question meets "followed space character" exception rule)).
the attribute defined containing cdata:
<!element option - o (#pcdata) -- selectable choice --> <!attlist option %attrs; -- %coreattrs, %i18n, %events -- selected (selected) #implied disabled (disabled) #implied -- unavailable in context -- label %text; #implied -- use in hierarchical menus -- value cdata #implied -- defaults element content -- >
— http://www.w3.org/tr/html4/interact/forms.html#h-17.6
cdata sequence of characters document character set , may include character entities. user agents should interpret attribute values follows:
- replace character entities characters,
- ignore line feeds,
- replace each carriage return or tab single space.
user agents may ignore leading , trailing white space in cdata attribute values (e.g., " myval " may interpreted "myval"). authors should not declare attribute values leading or trailing white space.
for html 4 attributes cdata attribute values, specification imposes further constraints on set of legal values attribute may not expressed dtd.
— http://www.w3.org/tr/html4/types.html#type-cdata
the specification doesn't impose additional limits option element's value attribute.
Comments
Post a Comment