what is placeholder in html

what is placeholder in html

1 year ago 93
Nature

The placeholder attribute is an HTML attribute that defines the text displayed in a form control when the control has no value. The placeholder text should provide a brief hint to the user as to the expected type of data that should be entered into the control. Effective placeholder text includes a word or short phrase that hints at the expected data type, not an explanation or prompt. The placeholder attribute is supported by the following input types: text, search, url, tel, and password, as well as the textarea element.

It is important to note that the placeholder must not be used instead of a label, as the placeholder is not visible if the value of the form control is not null, using placeholder instead of a label for a prompt harms usability and accessibility. Placeholders should only be used to show an example of the type of data that should be entered into a form; never as a replacement for a label. If the placeholder text contains instructional information or examples that disappear, it can be confusing to users with cognitive issues and can make the form inaccessible if the placeholder contained the label.

Read Entire Article