A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-input-placeholder-attribute/ below:

HTML | <input> placeholder Attribute

HTML | <input> placeholder Attribute

Last Updated : 12 Aug, 2022

The <input> placeholder attribute in HTML is used to specify the expected value to be displayed before user input in the input element. Syntax: 

<input placeholder="text"> 

Attribute Values: This attribute contains a single value text which specifies a short hint that describes the expected value of the input field. Example: This Example illustrates the use of Placeholder attribute in <input> element. 

html
<!DOCTYPE html>
<html>

<body>
    <center>
        <h1 style="font-size:25px;font-style:italic;">
          GeeksForGeeks
      </h1>
        <h2 style="font-size:25px;font-style:italic;">
          HTML input Placeholder Attribute
      </h2>
      
        <form action=" ">
            <input type="text"
                   name="fname"
                   placeholder="First name">
            <br>
            <input type="text"
                   name="lname" 
                   placeholder="Last name">
            <br>
            <input type="submit" 
                   value="Submit">
        </form>
  </center>
</body>

</html>

Output:

  

Supported Browsers: The browser supported by HTML <input> Placeholder Attribute are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4