HTML attribute placeholder

What is it?

Placeholder is a new html attribute introduced in HTML5. It is thought to be used in forms as a hint for users to know what to fill in to an specific input. Therefore, just reading a little and short clue, the user who is filling in the form, will not need to read completely the label next to the input since the html attribute placeholder tells him or her what to introduce.

The text of the html attribute placeholder only appears in those inputs the programmer specifies. And this text can be an example of what to fill in the input, a brief description, or whatever the programmer wants to show.

The text in the attribute will be shown until the Web user starts to fill in the input, that means the placeholder does not disappear when the user focuses on the input. The text of the html attribute placeholder only disappears when the user starts to write.

Where to use it?

This new HTML5 attribute can be used in the following input types: text, search, url, phone, email and password.

By clicking here, you will be able to read both, information about browser’s version which fully support html attribute placeholder, and all the important information about this attribute.

How to use it?

To set placeholder attribute, you only need to specify it into the input tag in the same way it is done when specifying class or id tag. So, the following is an example of how to do it:

<input type="text" placeholder="Placeholder text">

More about html attribute placeholder

Are yoy interested in learning more about placeholder? I have just published a new post about how to stylize placeholder text using CSS.

Lastly, you may want to share, comment or rank this post.