Skip to content
Related Articles

Related Articles

How to specify a short hint that describes the expected value of an input element using HTML ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 09 Feb, 2022

The placeholder attribute specifies a short hint for input field that describes the expected value of an input field/text area. The short hint is displayed in the field before the user enters a value.

Syntax:

<element placeholder="value">

Attribute Value: This attribute describes the short hint in the input field.

Example:

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        How to specify a short hint
        that describes the expected
        value of an input element?
    </title>
</head>
 
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
 
    <h3>
        How to specify a short hint that
        describes <br>the expected
        value of an input element?
    </h3>
 
    <form action=" ">
        <input type="text" name="fname"
            placeholder="First name">
        <br><br>
 
        <input type="text" name="lname"
            placeholder="Last name">
        <br><br>
 
        <input type="submit" value="Submit">
    </form>
</body>
 
</html>


Output:

Supported Browsers: The browser supported by placeholder Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!