W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2008

[whatwg] Placeholder option for text input boxes

From: Andy Lyttle <whatwg@phroggy.com>
Date: Tue, 30 Sep 2008 10:37:24 -0700
Message-ID: <CEDD9315-F3D4-42DB-85A0-125CB6D077F3@phroggy.com>
On Sep 30, 2008, at 7:00 AM, Tab Atkins Jr. wrote:

> Hm.  I have a problem with your example.  "Get local weather  
> forecast" isn't a semantic <label> for the field - it doesn't  
> describe what the field is for.  It describes what the *form* is  
> for, and so should be a <legend> or <hn>.  "City, State" actually  
> describes the use of the <input> itself, and should be the label.

Hmm, good call.  Let's see if I can do better:

<label for="hair">Hair:</label>
<input name="hair" id="hair" placeholder="Color" title="Enter the  
color of your hair"><br>

<label for="eyes">Eyes:</label>
<input name="eyes" id="eyes" placeholder="Color" title="Enter the  
color of your eyes"><br>

<label for="nose">Nose:</label>
<input name="nose" id="nose" placeholder="Shape" title="Describe the  
shape of your nose"><br>

<label for="birthplace">Place of Birth:</label>
<input name="birthplace" id="birthplace" placeholder="City, State"  
title="Enter the city and state where you were born"><br>

This shows how label AND placeholder AND title could be used for  
three different purposes.  If I were designing the spec from scratch,  
I might have chosen "tooltip" and "hint" instead of "title" and  
"placeholder" respectively, but we have to consider existing  
implementations.

-- 
Andy Lyttle
whatwg at phroggy.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080930/b156cb24/attachment.htm>
Received on Tuesday, 30 September 2008 10:37:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:05 UTC