w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
BEST WEB HOSTING JustHosts

HTML Reference

HTML by Alphabet
HTML by Function
HTML Attributes
HTML Events
HTML Valid DTDs
HTML Colornames
HTML Colorpicker
HTML Colormixer
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTTP Messages

HTML Tags

<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<dd>
<del>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<fieldset>
<font>
<form>
<frame>
<frameset>
<head>
<h1> - <h6>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<menu>
<meta>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<style>
<sub>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<title>
<tr>
<tt>
<u>
<ul>
<var>

HTML <input> type Attribute

HTML input Tag Reference HTML <input> tag

Example

A simple HTML form with two input fields and one submit button:

<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" /><br />
  Last name: <input type="text" name="lname" /><br />
  <input type="submit" value="Submit" />
</form>

Try it yourself »  (more examples below)

Definition and Usage

The type attribute specifies the type of an input element.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The type attribute is supported in all major browsers.


Syntax

<input type="value" />

Attribute Values

Value Description
button Defines a clickable button (mostly used with a JavaScript to activate a script)
checkbox Defines a checkbox
file Defines an input field and a "Browse..." button, for file uploads
hidden Defines a hidden input field
image Defines an image as a submit button
password Defines a password field. The characters in this field are masked
radio Defines a radio button
reset Defines a reset button. A reset button clears all data from a form
submit Defines a submit button. A submit button sends form data to a server
text Defines a one-line input field that a user can enter text into. Default width is 20 characters


Text

<input type="text" /> defines a one-line input field that a user can enter text into.

Example

Email: <input type="text" name="email" /><br />
Pin: <input type="text" name="pin" />

Try it yourself »


Button

<input type="button" /> defines a clickable button, that does not do anything. The button type is most often used to activate a JavaScript when a user clicks on the button.

Example

<input type="button" value="Click me" onclick="msg()" />

Try it yourself »


Checkbox

<input type="checkbox" /> defines a checkbox. Checkboxes let a user select one or more options of a limited number of choices.

Example

<input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
<input type="checkbox" name="vehicle" value="Car" /> I have a car

Try it yourself »


File

<input type="file" /> is used for file uploads.

Example

<input type="file" />

Try it yourself »


Hidden

<input type="hidden" /> defines a hidden field. A hidden field is not visible for the user. Hidden fields often store a default value, or have their value changed by a JavaScript.

Example

<input type="hidden" name="country" value="Norway" />

Try it yourself »


Image

<input type="image" /> defines an image as a submit button.

The src and alt attribute are required with <input type="image">.

Example

<input type="image" src="submit.gif" alt="Submit" />

Try it yourself »


Password

<input type="password" /> defines a password field. The characters in a password field are masked (shown as asterisks or circles).

Example

<input type="password" name="pwd" />

Try it yourself »


Radio

<input type="radio" /> defines a radio button. Radio buttons let a user select only one of a limited number of choices.

Example

<input type="radio" name="sex" value="male" /> Male<br />
<input type="radio" name="sex" value="female" /> Female

Try it yourself »


Reset Button

<input type="reset" /> defines a reset button. A reset button clears all data in a form.

Tip: Use the reset button carefully! It can be annoying for users who accidentally activate the reset button.

Example

<input type="reset" />

Try it yourself »


Submit

<input type="submit" /> defines a submit button. A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute.

Example

<form action="form_action.asp" method="get">
Email: <input type="text" name="email" /><br />
<input type="submit" />
</form>

Try it yourself »


HTML input Tag Reference HTML <input> tag

Altova® XMLSpy® - The industry-leading XML editor!

Altova XMLSpy

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web development needs from start to finish. New features in Version 2010!

  • XML editor
  • Graphical XML Schema / DTD editors
  • XSLT 1.0/2.0 editor, debugger, profiler
  • XQuery editor, debugger, profiler
  • XBRL validator, taxonomy editor, taxonomy wizard
  • Support for Office Open XML (OOXML)
  • Graphical WSDL 1.1/2.0 editor & SOAP debugger
  • JSON editing & conversion
  • Java, C#, C++ code generation
  • And much more!

Download a free trial today!

  Altova XMLSpy


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
WEB BUILDING
Download XML Editor
FREE Flash Website
FREE Web Templates
Stunning Flash Charts
PHP Form
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display