Back to Content

HTMLInputElement: placeholder property

files/en-us/web/api/htmlinputelement/placeholder/index.md

latest696 B
Original Source

{{ APIRef("HTML DOM") }}

The placeholder property of the {{DOMxRef("HTMLInputElement")}} interface represents a hint to the user of what can be entered in the control. It reflects the {{htmlelement("input")}} element's placeholder attribute.

Value

A string.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("input")}}
  • {{DOMXref("HTMLInputElement.value")}}
  • {{cssxref("::placeholder")}} pseudo-element
  • {{CSSXref(":placeholder-shown")}} pseudo-class