Click to See Complete Forum and Search --> : Using SELECTED in XHTML


Tim158
01-30-2003, 04:36 AM
Hi there,

Is there any way to use the SELECTED or CHECKED attribute in the OPTION element while remaining XHTML valid?

...or is there a simple javascript way around the problem?

Thanks in advance,
Tim.

Charles
01-30-2003, 05:02 AM
From the XHTML 1.0 Specificaation:
XML does not support attribute minimization. Attribute-value pairs must be written in full. Attribute names such as compact and checked cannot occur in elements without their value being specified.

CORRECT: unminimized attributes

<dl compact="compact">

INCORRECT: minimized attributes

<dl compact>

http://www.w3.org/TR/xhtml1/#h-4.5