The Placeholder Arribute in HTML5

Here we will learn about use of Placeholder Attribute in HTML5.

The Placeholder Arribute in HTML5

 
The placeholder attribute is used for providing a hint to the user during form entry. Placeholder text is appeared in the input field and it disappeared when the corresponding field gets focus. Now we use to placeholder attribute. Its syntax is given below:
 
<input type="type" name="name" placeholder="Hint Text" >
 
We write the following code:
  1. <!DOCTYPE HTML>  
  2. <html>  
  3.     <body>  
  4.         <form method="get">  
  5. First Name  
  6.             <input type="text" name="fname" placeholder="Your First Name" />  
  7.             <br/>  
  8. Last Name  
  9.             <input type="text" name="lname" placeholder="Your Last Name"/>  
  10.             <br/>  
  11. Email   
  12.             <input type="email" name="EMail" placeholder="Your email id"/>  
  13.             <br/>  
  14.             <input type="submit" />  
  15.         </form>  
  16.     </body>  
  17. </html>  
Then we run this code. The output will look like as below:
 
placeholder arrtibute