Advertisement
Home Open Editor ❯

HTML placeholder Attribute

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>

Try this code ❯

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">


Applies to:

The placeholder attribute can be used on the following element:


Advertisement

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>

Try this code ❯

Home Open Editor ❯
Advertisement