Skip to main content
codingCourses
  • HTML
  • CSS
  • JavaScript
  • PHP
  • HTML Tutorial
  • HTML Elements
  • HTML Attributes
  • Special Characters & Emojis
  • Practical Tips
HTML
  • HTML Tutorial
  • <!DOCTYPE html>
    The Correct Meaning of the Declaration
HTML Elements
  • HTML Element Reference
  • <a>
  • <abbr>
  • <address>
  • <article>
  • <aside>
  • <blockquote>
  • <body>
  • <br>
  • <button>
  • <cite>
  • <del>
  • <details>
  • <summary>
  • <dfn>
  • <div>
  • <dl>
  • <dt>
  • <dd>
  • <em>
  • <fieldset>
  • <legend>
  • <figure>
  • <figcaption>
  • <footer>
  • <form>
  • <head>
  • <header>
  • <hr>
  • <html>
  • <h1>~<h6>
  • <iframe>
  • <img>
  • <input>
  • <ins>
  • <kbd>
  • <label>
  • <li>
  • <link>
  • <main>
  • <mark>
  • <menu>
  • <meta>
  • <nav>
  • <noscript>
  • <ol>
  • <p>
  • <q>
  • <picture>, <source>
  • <script>
  • <section>
  • <select>
  • <span>
  • <strong>
  • <style>
  • <sub>
  • <sup>
  • <template>
  • <textarea>
  • <time>
  • <title>
  • <ul>
HTML Attributes
  • HTML Attribute Reference
  • cite
    Referencing the Source URL
  • class
    Specifying One or More Class Names
  • contenteditable
    Making HTML Elements Editable
  • crossorigin
    Specifying CORS Request Modes
  • data-*
    Standard Custom Data Attributes
  • datetime
    Specifying the Date and Time
  • enterkeyhint
    Specifying the Enter key for virtual keyboards
  • hidden
    Indicating Hidden Elements
  • id
    Specifying a Unique Element Identifier
  • <img> alt
    Specifying Alternative Text for Images
  • <img> srcset, sizes
    Responsive Images with <img>
  • <input> type
    Specifies Various Input Control Types
  • <input type="button">
  • <input type="checkbox">
  • <input type="hidden">
  • <input type="number">
  • <input type="password">
  • <input type="radio">
  • <input type="reset">
  • <input type="search">
  • <input type="submit">
  • <input type="text">
  • <input type="url">
  • inputmode
    Specifying the Virtual Keyboard Input Mode
  • lang
    Specifying the Primary Language
  • rel
    Meaning, List, and Examples
  • <link rel="dns-prefetch">
    Prefetching DNS Information
  • <link rel="preconnect">
    Preconnecting to External Domains
  • <link rel="prefetch">
    Prefetching Future Resources
  • <link rel="preload">
    Preloading Resources
  • role
    A Guide to ARIA Roles & Accessibility
  • style
    Applying CSS Styles Directly to an Element
  • title
    Advisory Information for the Element
HTML Special Characters & Emojis
  • Special Character & Emoji Reference
  • HTML Special Characters
    Avoiding Conflicts with Reserved Symbols
  • HTML Special Characters List
    Organized HTML Special Characters List
  • Using Emoji in Your Web Pages
    How to Add Emoji to HTML Pages
  • Emoji List
    Includes Unicode and HTML Entity Codes
  • Kaomoji List
    by Emotion and Situation
HTML Practical Tips
  • Practical Tip Reference
  • Open Graph Protocol
    Setting Up Social Media Share Previews
  • The Complete Guide to <video> Autoplay
    Why It’s Not Working and How to Fix It

HTML <input> type Attribute: Specifies Various Input Control Types

HTML Attributes Home Previous Next

Definition and Usage

The <input> tag offers a wide range of control types based on the value of its type attribute.

The behavior and appearance of the input field vary depending on the value of the type attribute.

type Attribute

The available type attribute values and their descriptions are summarized below.

If the type attribute is not specified, its default value is text.

type attribute values not supported by some major browsers have been excluded.

Input type Attribute Values and Descriptions
type Description Basic Example
<input type="button"> This is a button with no default behavior.
It can be used with JavaScript to perform various actions.
<input type="checkbox"> This is a checkbox.
It allows a single value to be checked and unchecked. It is generally square, but its corners may be rounded.
<input type="color"> This is an input field in the form of a color picker that allows the user to select or enter a color.
It opens a color picker when activated in the browser.
<input type="date"> This is a date input control.
It opens a date picker or numeric wheel for the year, month, and day when activated in the browser.
<input type="datetime-local"> This is an input field that provides a date and time selection interface for easily entering a date and time at once.
<input type="email"> This is an email address input field.
It looks like a text input, but on some devices with dynamic virtual keyboards (such as mobile devices), it supports a keyboard that helps with entering email addresses such as the @ and . characters.
<input type="file"> This is an input field that allows users to select and upload files from their devices.
<input type="hidden"> This is a hidden input field that is not visible to users but allows data to be submitted along with the form.
<input type="image"> This is a form (<form>) submit button displayed as an image rather than text.
Clicking this button submits the values of all submittable controls in the form containing the element.
<input type="number"> This is a numeric input field.
It displays a spinner and performs validation to allow only numbers to be entered. On some devices with dynamic virtual keyboards (such as mobile devices), it displays a numeric keypad.
<input type="password"> This is a password input field.
The browser hides sensitive information entered by the user by replacing text characters with symbols such as bullets (•), making them unreadable on the screen.
<input type="radio"> This is a radio button.
It is generally rendered as a small circle and is filled or highlighted when selected.
<input type="range"> This is a range slider that allows a value to be selected within a specified numeric range.
<input type="reset"> This is a form (<form>) reset button.
When this button is clicked, it resets the values of all controls in the form containing this element.
<input type="search"> This is a search term input field.
It is a single-line text input control, and on some devices with dynamic virtual keyboards (such as mobile devices), it supports a search icon.
Depending on the browser, it may include a delete icon that can be used to clear the field.
<input type="submit"> This is a form (<form>) submit button.
Clicking this button submits the values of all submittable controls in the form containing the element.
<input type="tel"> This is a phone number input field.
It is a single-line text input control and does not validate the phone number format.
<input type="text"> This is the default value of the type attribute and is a general text input field.
It is a single-line text input control.
<input type="time"> This is an input control that provides a time selection interface for easy entry of a time.
<input type="url"> This is a URL input field.
It looks like a text input, but on some devices with dynamic virtual keyboards (such as mobile devices), it supports a keyboard that helps with entering URLs, with keys for characters such as / and . and keys for quickly entering strings commonly found in domain names, such as www. or .com.

Good to Know!
The interface or styling of a control based on the value of the type attribute may vary slightly depending on the browser and operating system.

Browser Compatibility

Browser Compatibility for the type Attribute Values of the input Tag
Attribute Value
Desktop Chrome
Chrome
Desktop Edge
Edge
Desktop Firefox
Firefox
Safari
Safari
type="button" 1 12 1 1
type="checkbox" 1 12 1 1
type="color" 20 14 29 12.1
type="date" 20 12 53 14.1
type="datetime-local" 20 12 93 14.1
type="email" 5 12 1 5
type="file" 1 12 1 1
type="hidden" 1 12 1 1
type="image" 1 12 1 1
type="number" 7 12 29 5.1
type="password" 1 12 1 1
type="radio" 1 12 1 1
type="range" 4 12 23 3.1
type="reset" 1 12 1 1
type="search" 5 12 4 10.6
type="submit" 1 12 1 1
type="tel" 3 12 1 4
type="text" 1 12 1 1
type="time" 20 12 57 14.1
type="url" 1 12 1 1

Specifications

Specification for the input type Attribute
Specification
<input type="value"> HTML Standard
#attr-input-type

References

  • MDN - <input>: The Input (Form Input) element

See Also

  • HTML enterkeyhint Attribute – Specifying the Enter key action for virtual keyboards
  • HTML inputmode Attribute – Specifying the Virtual Keyboard Input Mode
HTML Attributes Home Previous Next

codingCourses offers coding tutorials made for everyone.
All materials and examples are continuously reviewed to prevent errors; however, complete accuracy cannot be guaranteed.
Therefore, please carefully test and review all materials and examples to ensure they are free of errors, bugs, or vulnerabilities before relying on them.
They are available under the Creative Commons Attribution 4.0 International

Copyright © codingCourses. All Rights Reserved.