Valid characters in parameter value

I'm just wondering what valid characters can be included as a value for <option>

i.e. it's really?

<select>
    <option value='0dbl,2sgl'>0 Double and 2 Singles</option>
    <option value='1dbl,0sgl'>1 Double and 0 Singles</option>
</select>
+5
source share
2 answers

Yes, that’s absolutely true. See specification : he says that content valueshould be CDATAin which almost everything is permissible, with the following reservations:

  • Replace symbolic entities with symbols,
  • Ignore line channels,
  • Replace each carriage return or tab with one space.
+10
source

For HTML4:

OPTION Attribute definitions

selected [CI]
  When set, this boolean attribute specifies that this option is pre-selected.
value = cdata [CS]
  This attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the OPTION element.
label = text [CS]
  This attribute allows authors to specify a shorter label for an option than the content of the OPTION element. When specified, user agents should use the value of this attribute rather than the content of the OPTION element as the option label.

Source: http://www.w3.org/TR/html401/interact/forms.html#h-17.6

So, we turn to the definition of CDATA:

CDATA - . :

  • ,
  • ,
  • . CDATA (, "myval" "myval" ). .

HTML 4 CDATA , , DTD.

: http://www.w3.org/TR/html401/types.html#type-cdata

, value , .

+3

All Articles