Skip to main content
add missing label and explain limits of placeholders
Source Link
Andy
  • 6.4k
  • 2
  • 32
  • 53

I know this is old, but theYou should not use this approach to provide examples for input values (any more).

The best option is to now use the new placeholder HTML attributeplaceholder HTML attribute if possible:

<label for="userid">User ID</label> <input type="text" id="userid" name="userid" placeholder="Please enter the user ID" /> 

This will cause the text to show unless a value is entered, eliminating the need to select text or clear inputs.

Beware that placeholders are no replacement for labels, as they disappear once text is entered, and pose issues for accessibility.

I know this is old, but the best option is to now use the new placeholder HTML attribute if possible:

<input type="text" id="userid" name="userid" placeholder="Please enter the user ID" /> 

This will cause the text to show unless a value is entered, eliminating the need to select text or clear inputs.

You should not use this approach to provide examples for input values (any more).

The best option is to now use the placeholder HTML attribute if possible:

<label for="userid">User ID</label> <input type="text" id="userid" name="userid" placeholder="Please enter the user ID" /> 

This will cause the text to show unless a value is entered, eliminating the need to select text or clear inputs.

Beware that placeholders are no replacement for labels, as they disappear once text is entered, and pose issues for accessibility.

Source Link
Thom Porter
  • 2.6k
  • 2
  • 22
  • 24

I know this is old, but the best option is to now use the new placeholder HTML attribute if possible:

<input type="text" id="userid" name="userid" placeholder="Please enter the user ID" /> 

This will cause the text to show unless a value is entered, eliminating the need to select text or clear inputs.