Computer >> Computer tutorials >  >> Programming >> HTML

HTML <textarea> placeholder Attribute


The placeholder attribute of the <textarea> element is used to set a placeholder text in the textarea. A placeholder is considered as a hint, like “Enter you name”, “Enter mobile number”, “Write in 100 words”, etc.

Following is the syntax−

<textarea placeholder="text">

Above, text is the hint you want to set for the textarea as a placeholder text.

Let us now see an example to implement the placeholder attribute of the <textarea> element−

Example

<!DOCTYPE html>
<html>
<body>
<h2>Interview Questions</h2>
<p>Q1</p>
<textarea rows="6" cols="70" placeholder="Why do you want go for the Editor Job Profile? (100 words)">
</textarea>
<p>Q2</p>
<textarea rows="6" cols="70" placeholder="Do you have any previous publishing experience? (100 words)">
</textarea>
</body>
</html>

Output

HTML <textarea> placeholder Attribute

In the above example, we have set two textarea−

<p>Q1</p>
<textarea rows="6" cols="70" placeholder="Why do you want go for the Editor Job Profile? (100 words)">
</textarea>
<p>Q2</p>
<textarea rows="6" cols="70" placeholder="Do you have any previous publishing experience? (100 words)">
</textarea>

To display a placeholder text, the placeholder attribute is used, for example−

placeholder="Why do you want go for the Editor Job Profile? (100 words)"