[whatwg] Placeholder option for text input boxes

Andy Lyttle whatwg at phroggy.com
Tue Sep 30 10:37:24 PDT 2008


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-0001.htm>


More information about the whatwg mailing list