O'Reilly logo

HTML & XHTML: The Definitive Guide, 6th Edition by Bill Kennedy, Chuck Musciano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <input> Tag

Use the <input> tag to define any one of a number of common form “controls,” as they are called in the HTML and XHTML standards, including text fields, multiple-choice lists, clickable images, and submission buttons. Although there are many attributes for the <input> tag, only the name attribute is required for each element (but not for a submission or reset button; see the following explanation). And as we describe in detail later, each type of input control uses only a subset of the allowed attributes. Additional <input> attributes may be required based upon which type of form element you specify.

Table 9-1 summarizes the various form <input> types and attributes, required and optional.

Table 9-1. Required and some common form element attributes

Form tag or <input> type

Attributes (× = required; ▴ = optional; blank = not supported)

accept

accesskey

align

alt

border

cols

checked

disabled

maxlength

multiple

name

notab

onBlur

onChange

onClick

onFocus

onSelect

readonly

rows

size

src

tabindex

taborder

usemap

value

wrap

button

 

     

  

×

 

     

 

×

 

checkbox

 

    

  

×

  

  

   

 

×

 

file

     

 

×

 

 

 

 

 

hidden

          

×

             

×

 

image

 

  

  

  

     

×

  

password

 

     

 

×

 

 

 

×

 

radio

 

    

  

×

  

  

   

 

×

 

reset

 

     

   

  

      

 

 

submit

 

     

  

  

      

 

 

text

 

     

 

×

 

 

 

 

<button>

 

     

  

×

 

 

     

  

 

<select>

       

 

×

 

   

 

    

<textarea>

 

   

 

  

×

 

  

   

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required