input maxlength - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

The maxlength attribute specifies an upper limit for the number of characters that the user can enter.

The size attribute specifies how many characters the text box can display.

The following code shows how to use the maxlength and size Attributes.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <form method="post" action="http://example.com/form"> 
         <p> 
            <label for="name">
                Name: <!-- www.j a v  a2  s  .com-->
               <input maxlength="10" id="name" name="name"> 
            </label> 
         </p> 
         <p> 
            <label for="city">
                City: 
               <input size="10" id="city" name="city"> 
            </label> 
         </p> 
         <p> 
            <label for="fave">
                Fruit: 
               <input size="10" maxlength="10" id="fave" name="fave"> 
            </label> 
         </p> 
         <button type="submit">Submit Vote</button> 
      </form>  
   </body>
</html>

Related Tutorials