Skip to main content

HTML Guide

Attribute “placeholder” is only allowed when the input type is “email”, “number”, “password”, “search”, “tel”, “text”, or “url”.

The placeholder attribute is used on <input> elements as text that appears in the form control when it has no value set. Only inputs of type email, number, password, search, tel, text, or url accept this attribute.

For example, an input of type hidden doesn’t accept a placeholder attribute as it makes no sense to specify text to appear when the input is empty, if that input is hidden.

Learn more: