views:

46

answers:

2

According to the w3 XHTML specification, the label attribute specifies a shorter label for the option. However (using the try-it tool with FF3.5), I can't see any effect. Hence my question: what does this attribute really do?

EDIT It seems that it overrides the label used in the dropdown list. The contents of the option are (as far as I know) only used as the default for the value. Does this (in IE7+) make the following two declarations equivalent?

<option label="Volvo">Volvo (Latin for 'I roll')</option>

and

<option label="Volvo" value="Volvo (Latin for 'I roll')">Whatever....</option>
+4  A: 

Note: The label attribute is only supported by IE 7+. Try in IE and you will see the difference.

Pentium10
Agreed, ignore this attribute: http://www.w3schools.com/tags/att_option_label.asp
Nick Craver
A: 
AJ
This is exactly the documentation I'm linking to in the questeion. Sure, I've seen that it's not required. Still was wondering what it's for.
Martijn
@Martijn, I updated my answer to indicate what I think this feature would be useful for if it were implemented fully in browsers. Maybe this changes your opinion of my answer.
AJ
+1 link to the in-depth specs (downvote isn't mine - sorry)
Martijn
Once again: great edit. Hadn't thought of this.
Martijn