HTML placeholder Attribute

❮ HTML Attributes

Example

<form action="action.php">
	<label for="fname">First name:</label>
	<input type="text" id="fname" name="fname" placeholder="First Name"><br>
	<input type="submit" value="Submit">
</form>

Meaning

The placeholder attribute specifies a short bit of text that is used to help the user figure out what type of information to fill in for a form control.

The text will be placed in the field and cleared on entering.




Standard Syntax

<element placeholder="text">



Browser Support




Status




Applies to:

The placeholder attribute can be used on the following element:

Element Attribute
<input> placeholder
<textarea> placeholder






Attribute Values

Value Description
text Specifies a text that specify the expected value of the input field be.



More Examples

Example

<form action="action.php">
	<label for="demo">textarea demo:</label>
	<textarea placeholder="please enter text here..." id="demo" name="textareaText"></textarea>
	<br><br>
	<input type="submit" value="Submit">
</form>
❮ HTML Attributes