HTMLInputElement: placeholder property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{ 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](/en-US/docs/Web/HTML/Reference/Elements/input#placeholder) attribute.

Value

A string.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

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