YouTip LogoYouTip

Prop Textarea Placeholder

Textarea placeholder Property |

-- Learning not just technology, but dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

HTML DOM tr Object

HTML DOM Title Object

Deep Dive

  • Software
  • Scripts
  • Computer Science
  • Development Tools
  • Web Services
  • Programming
  • Scripting Languages
  • Programming Languages
  • Web Design and Development
  • Web Service

Textarea placeholder Property

Textarea Object Reference Textarea Object


Example

Change the placeholder (expected value) attribute of a textarea:

document.getElementById("myTextarea").placeholder = "Enter search keywords...";

Try it yourself Β»

Definition and Usage

The placeholder property is used to set or return the value of the placeholder attribute of a textarea element.

The placeholder attribute specifies a short hint that describes the expected value of a textarea element.

The placeholder is displayed when the textarea element is empty and disappears when the textarea element gains focus.


Browser Support

Property Chrome Edge Firefox Safari Opera
placeholder Yes 10.0 Yes Yes Yes

Syntax

Return the placeholder property:

textareaObject.placeholder

Set the placeholder property:

textareaObject.placeholder = text

Property Values

Value Description
text A string that specifies the expected value of the textarea element.

Technical Details

Return Value: A string that represents the expected value of the textarea element.


More Examples

Example

Get the value of the placeholder (expected value) attribute of a textarea:

var x = document.getElementById("myTextarea").placeholder;

Try it yourself Β»


Textarea Object Reference Textarea Object

← Bootstrap5 TutorialPerl Switch Statement β†’