HTML: Input Tag

By Xah Lee. Date: . Last updated: .

2018-10-23 This page is under revision

The input tag is used to generate many different types of inputs such as buttons, menu, checkboxes, search box, message box, etc.



  1. Button
  2. Text Field
  3. Password Field
  4. Textarea
  5. Number Field
  6. Radio Button πŸ”˜
  7. Checkbox πŸ—Ή
  8. Popup Menu β–€
  9. Slider 🎚
  10. Color Picker 🌈

the following is work in progress


<input type="file" />


<input type="hidden" />


<input type="date" />


<input type="datetime-local" />


<input type="email" />


<input type="image" />


<input type="month" />


<input type="search" />


<input type="tel" />


<input type="time" />


<input type="url" />


<input type="week" />

Submit Buttons

INPUT with attribute type="submit" draws submit buttons. When these buttons are pressed, the form is sent to the CGI program. The name and value attributes are optional.

Submit button 1:

<input type="submit" name="submit1">

Multiple Submit Buttons

You can have multiple submit buttons, with name and value attributes. The name attribute can be the same. The value of the value will be shown as the text on button, and is the value string sent to the server.

<input type="submit" name="license_agreement" value="agree">
<input type="submit" name="license_agreement" value="disagree">

Reset Button

The type="reset" shows a button with a special action that tells the browser to reset the form.

<input type="reset" name="reset" value="Reset">

Web Scripting Overview

  1. Browser Window Object, DOM
  2. Intro to Event-Based Programing
  3. JavaScript Load Order

DOM How-To

  1. Basic DOM Methods
  2. Get Element by ID, Tag, Name, Class, CSS
  3. Change CSS
  4. Change Node Content
  5. Create/Insert Node
  6. Remove Node
  7. Get Attribute Value
  8. Set Attribute Value
  9. Remove Attribute
  10. List/Add/Remove Class Attribute
  11. Add/Remove Event Handler
  12. Navigate DOM Tree
  13. Node Type, Name, Value

HTML Input

  1. Button
  2. Text Field
  3. Password Field
  4. Textarea
  5. Email πŸ“§
  6. Number Field
  7. Radio Button πŸ”˜
  8. Checkbox πŸ—Ή
  9. Popup Menu β–€
  10. Slider 🎚
  11. Color Picker 🌈

Web Scripting Examples

  1. Disable Right Click
  2. document.write
  3. Image Rollover
  4. Pop-up New Window
  5. Digital Clock
  6. Stopwatch
  7. Fade a Element
  8. How to Create Tooltip
  9. Falling Snow Effect
  10. Box Following Scroll

Web Scripting Misc

  1. Web Cookies
  2. Web Storage
  3. DOM: Open URL
  4. Encode URL, Escape String
  5. Browser Info, Navigator Object
  6. Get URL (window.location)
  7. Find Window Width
  8. Find Element Width
  9. WebSocket
  10. Value of β€œthis” in Event Handler
  11. Event Delegation
  12. Get Current Script Tag
  13. insertAfter Element
  14. Randomize List
  15. create Document Fragment
  16. innerHTML, nodeValue, textContent, innerText?
  17. What is Live Object
  18. NodeList vs HTMLCollection
  19. Whitespace Nodes


  1. jQuery Basics
  2. jQuery() vs querySelectorAll()
  3. Write JQuery Plugin


Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials