HTML

HTML Intro

HTML Intro Quiz

HTML Intro Exercise

HTML Basics

HTML Basic Quiz

HTML Basic Exercise

HTML Advance

HTML Advance Quiz

HTML Advance Exercise

HTML Tags List

HTML Global Attributes

HTML Attributes

FAQs

HTML input Tag

HTML input Tag

 

 

The input tag specifies an input field where the user can enter data. It is a widely used element of the form element. It has a wide range of variety depending on the type attribute.

 

Input Types:-

 

  • < input type="text" >
  • < input type="checkbox" >
  • < input type="color" >
  • < input type="submit" >
  • < input type="email" >
  • < input type="hidden" >
  • < input type="image" >
  • < input type="month" >
  • < input type="number" >
  • < input type="radio" >
  • < input type="search" >
  • < input type="datetime-local" >
  • < input type="date" >
  • < input type="file" >
  • < input type="password" >
  • < input type="tel" >
  • < input type="range" >
  • < input type="reset" >
  • < input type="button" >
  • < input type="time" >
  • < input type="URL" >
  • < input type="week" >

 

Attribute Explanation:-

 

Attribute Value Description
accept file_extension
audio/*
video/*
image/*
media_type
Specifies filter for what file types user can pick from file input dialog box.
alt text Specifies alternate text for images.
autocomplete on
off
Specifies whether an input element should have autocomplete enabled.
autofocus autofocus Specifies that input element should automatically get focus when the page loads.
checked checked Specifies that input element should be pre-selected when the page loads.
dirname inputname.dir Specifies that text direction will be submitted.
disabled disabled Specifies that input element should be disabled.
form form_id Specifies that form input element belongs to.
formaction URL Specifies URL of file that will process input control when form is submitted.
formenctype application/x-www-form-urlencoded
multipart/form-data
text/plain
Specifies how form-data should be encoded when submitting it to server.
formmethod get
post
Defines HTTP method for sending data to action URL.
formnovalidate formnovalidate Defines that form elements should not be validated when submitted.
formtarget _blank
_self
_parent
_top
framename
Specifies where to display response that is received after submitting the form.
height pixels Specifies height of input element.
list datalist_id Refers to datalist element that contains pre-defined options for input element.
max number
date
Specifies maximum value for input element
maxlength number Specifies maximum number of characters allowed in input element.
min number
date
Specifies minimum value for input element
minlength number Specifies minimum number of characters required in input element.
multiple multiple Specifies that user can enter more than one value in input element.
name text Specifies name of input element.
pattern regexp Specifies regular expression that input element's value is checked against.
placeholder text Specifies short hint that describes expected value of input element.
readonly readonly Specifies that input field is read-only.
required required Specifies that input field must be filled out before submitting form.
size number Specifies width, in characters, of input element.
src URL Specifies URL of image to use as submit button.
step number
any
Specifies interval between legal numbers in input field.
type button
checkbox
color
date
datetime-local
email
file
hidden
image
month
number
password
radio
range
reset
search
submit
tel
text
time
url
week
Specifies type input element to display.
value text Specifies value of input element.
 
width pixels Specifies width of input element.

 

Syntax:-

 

Its syntax is:- < input >

Code Explanation

All Tutorials related to HTML Tags List

All Sections related to HTML