What is an Input Tag?

Mary Elizabeth

A tag is a formatting code that is part of a document language, also known as a markup language, used to annotate a text in a way that is distinct from the text and provides instructions for how the text is to be displayed. There are various markup systems that have a large number of unique tags. The markup systems or languages include TeX, Scribe, GML, SGML, HTML, XML, and XHTML. HTML stands for HyperText Markup Language and it is used in the World Wide Web to create structure for text and documents and to create hyperlinks between documents, while XHTML (extensible HTML) combines HTML and XML. The input tag is an HTML and XHTML tag, and it is supported by Microsoft® Internet Explorer®, Mozilla® Firefox®, Opera®, Google® Chrome®, and Apple® Safari® browsers.

Woman doing a handstand with a computer
Woman doing a handstand with a computer

Many HTML and XHTML tags serve to format text that is on the page, but some create opportunities for user interaction, and the input tag is one of the latter: it is a key player in building forms. There is an important difference between how the input tag is used in HTML and how it is used in XHTML, however. In HTML the tag <input> is used, with the ellipses replaced by whatever content the tag holds, and has no end tag. In XHTML, the input tag requires a proper closing like this <input/>.

The input tag must include the type attribute to specify the type of control field to be used. The possibilities are: button, checkbox, file, hidden, image, password, radio, reset, submit, and text. The button type usually has an action programmed with a client side script, such as JavaScript®, while the checkbox and radio buttons toggle on and off when clicked. The file type allows the user to upload a file, while hidden values are not displayed but stay attached to the form entry. Password differs from text in that it often has dots or asterisks to mask the characters that are entered, and submit, image — which is a kind of submit button — and reset are global treatments of form data.

You might also Like

Discuss this Article

Post your comments
Forgot password?