Creating TextBox in HTML 5

Introduction

 
TextBox is essential interface control for any application to get text input by user. Here we will create TextBox in HTML 5. We create TextBox by <input> tag with type="type_name"  attribute. Like as given below:
  1. <input type="text" >  
We take two TextBox by writing below code: 
  1. <!DOCTYPE HTML>  
  2. <html>  
  3.     <body>  
  4.         <form method="post">  
  5.     First Name  
  6.             <input type="text" name="fname"/>  
  7.     Last Name  
  8.             <input type="text" name="lname"/>  
  9.         </form>  
  10.     </body>  
  11. </html>  
Here fname and lname is a unique name for these control. When we run this code, The output will look like as below:
 
textbox
 
We also can define width of TextBox by size attributes as   
  1. <input type="text" name="fname" size="25"/>  
Now we run this code. The output will look like as below
 
textbox
 
We can also make TextBox to accept password by type="password" attribute value. Like below code
  1. <!DOCTYPE HTML>  
  2. <html>  
  3.     <body>  
  4.         <form method="post">  
  5.         First Name  
  6.             <input type="text" name="fname" size="25"/>  
  7.         Last Name  
  8.             <input type="text" name="lname" size="25"/>  
  9.             <br />  
  10.         Password  
  11.             <input type="password" name="pword" size="25" />  
  12.         </form>  
  13.     </body>  
  14. </html>  
We run this code. The output will look like as below:
 
textbox