W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] Option label, textContent and value

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 14 Jun 2011 01:10:17 -0700
Message-ID: <BANLkTinU1hChKsbSgfX_bRFKboPTkG21_g@mail.gmail.com>
On Tue, Jun 14, 2011 at 12:11 AM, Ian Hickson <ian at hixie.ch> wrote:
>> Furthermore, as I understand the above definitions, the spec does allow
>> to specify label and value in one step in a select element:
>>
>> <select>
>> ? <option>This is value and label
>> </select>
>>
>> But not in a datalist, as the label is taken from the textContent rather
>> than from the value of the option element:
>>
>> <datalist>
>> ? <option value="No label here">
>> ? <option label="No value here">
>> </datalist>
>
> The difference is that the value is typically shown in the datalist case.

At least <input type=email> seems like a very common example where
you'd want to show a label. Here you likely will want to show peoples
names, but choosing a name would use the email address as the .value
for the <input>.

/ Jonas
Received on Tuesday, 14 June 2011 01:10:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC