You may be morally correct but the label attribute of the option tag
is not widely supported:

http://www.w3schools.com/TAGS/att_option_label.asp



On May 7, 3:47 pm, Klaus Hartl <klaus.ha...@googlemail.com> wrote:
> Don't speculate, look 
> up:http://www.w3.org/TR/html401/interact/forms.html#h-17.6
>
> It's valid.
>
> "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."
>
> --Klaus
>
> On 7 Mai, 20:16, James <james.gp....@gmail.com> wrote:
>
> > I don't think "label" inside an option is a valid attribute. I'd
> > remove that. Is there a reason you're using that? Maybe you should
> > consider using the "title" attribute instead.
>
> > On May 6, 1:42 pm, "Michael B.  Williams" <mbw...@gmail.com> wrote:
>
> > > Consider the following select box:
>
> > > <select id="test">
> > > <option value=""></option>
> > > <option label="XS" value="1">XS</option>
> > > <option label="S" value="2">S</option>
> > > <option label="M" value="3">M</option>
> > > <option label="L" value="4">L</option>
> > > <option label="XL" value="5">XL</option>
> > > <option label="0" value="6">0</option>
> > > <option label="1" value="7">1</option>
> > > <option label="2" value="8">2</option>
> > > <option label="3" value="9">3</option>
> > > <option label="4" value="10">4</option>
> > > <option label="5" value="11">5</option>
> > > <option label="6" value="12">6</option>
> > > <option label="7" value="13">7</option>
> > > <option label="8" value="14">8</option>
> > > <option label="9" value="15">9</option>
> > > <option label="10" value="16">10</option>
> > > <option label="11" value="17">11</option>
> > > <option label="12" value="18">12</option>
> > > </select>
>
> > > If I do a $("#test").val(2) on this I would hope it would select "S",
> > > but instead it selects "2". Why is this setting the value of the
> > > select box based on the label rather than based on the value
> > > attribute?
>
> > > I am using Safari 4, by the way.
>
> > > Thanks

Reply via email to