One of the useful things in HTML5 is the placeholder
attribute that lets you specify a short hint for text input fields (textarea
elements and the text states of the input
element). In browsers that implement placeholder
according to the specification, the hint text is displayed only when the field is empty and unfocused.
This is good since it gives you an opportunity to provide the user with hints regarding what they are expected to enter in the field. What is not good is that the placeholder
attribute is often used as a substitute for the label
element. I’ve seen this in various demos of the placeholder
attribute as well as in demos for scripts that emulate the placeholder
attribute in browsers that don’t natively support it. So some developers appear to misunderstand what the placeholder
attribute is meant for and how it works.
Posted in Accessibility, HTML 5, Quick Tips, Usability.
Copyright © Roger Johansson