Forum Moderators: open

Message Too Old, No Replies

optgroup element as selected?

selected is not a valid attribute for the optgroup element.

         

JAB Creations

7:20 pm on Jan 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would like to make the optgroup element the selected element, is there a way to do this?

John

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
</head>

<body>

<div>
<select>
<optgroup label="Group">
<option value="1">Value 1</option>
<option value="2">Value 2</option>
<option value="3">Value 3</option>
<option value="4">Value 4</option>
<option value="5">Value 5</option>
</optgroup>
</select>
</div>

</body>
</html>

Robin_reala

7:58 pm on Jan 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not that I know of, as it doesn't take the select atribute [w3.org]. Are you trying to select multiple options? In this case you'd need to add the multiple attribute to the select element and the selected attribute to every option element you want to be selected.

JAB Creations

10:30 pm on Jan 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nah, I was just trying to select the optgroup but I settled with changing the submit button's text which should work just fine.

John