tags:

views:

19

answers:

3

What is the correct way to have the option tag default value set in IE6?

I've tried doing

<option SELECTED>
<option selected='selected'>
<option selected='true'>

none of them work in ie6, any ideas?

+1  A: 

Proper markup is:

<option selected="selected" value="1">Some Text</option>

Source

Parrots
+1  A: 

Depends on the doctype. If HTML, then you need

<option value="value1" selected>label1</option>

If XHTML (i.e. HTML massaged into XML flavor), then you need

<option value="value1" selected="selected">label1</option>

If still in vain, then the problem lies somewhere else. You'll need to post an SSCCE then, for example:

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 2073877</title>
    </head>
    <body>
        <select>
            <option value="value1">label1</option>
            <option value="value2" selected>label2</option>
            <option value="value3">label3</option>
        </select>
    </body>
</html>

This shows "label2" as selected option in all browsers, including IE6.

BalusC
+1  A: 
<option value="someValue" selected="selected">Label</option>
Darin Dimitrov