MDN self-hosted library · e01.org

HTMLInputElement: placeholder property

HTML DOM

Open notebook · 1 cells web-api-instance-property upstream source

HTML DOM

The placeholder property of the HTMLInputElement interface represents a hint to the user of what can be entered in the control. It reflects the input element's placeholder attribute.

Value

A string.

Examples

const inputElement = document.getElementById("phone");
console.log(inputElement.placeholder);

Specifications

Browser compatibility

See also

  • input
  • HTMLInputElement.value
  • ::placeholder pseudo-element
  • :placeholder-shown pseudo-class