input element



Input element is used to receive values from the user.
<form action="File Name">
Text<input type="text" name="lname" />
<input type="Value" value="Value"> </form>
Element Specific attributes supported by this element are: autocomplete
accept audio/*, video/*, image/*, MIME_type Defines the nature of files accepted by the server. It is available only for type = file.
alt text Lists alternate text for images. Available only for type "image".
autocomplete on & off Mentions <input> to have autocomplete enabled or not.
autofocus autofocus <input> will get focus automatically, if the page loads.
checked checked <input> should be prese
disabled disabled The <input> must be disabled.
form form_id Denotes multiple forms to which the <input> belongs to.
formaction url Mention about source of the file. It process the input control when the form is submitted.
formmethod get & post Illustrates the HTTP method to send data to the action URL. It is applicable for the attribute, type "submit" and type="image".
formnovalidate formnovalidate Form elements will not be validated when it has been submitted.
formtarget blank, _self, _parent, _top, framename Signifies at where to exhibit the response. The response is obtained after submitting form.
height pixels Mentions height of the <input>.
list datalist_id Signifies <datalist>. It owns predefined options for <input>.
max number & date Defines maximum value for <input>.
maxlength number Specifies regarding the maximum noumber of characters permitted in <input>.
min number & date Defines minimum value for <input>.
multiple multiple User is allowed to enter multiple vaues in <input>.
name text Name of <input> is mentioned.
pattern regexp Mentions about regular expression for checking the input value.
placeholder text short hint that depicts the expected value of <input>.
readonly readonly The input filed is readonly.
required required Input field should be filled before form is submitted.
size number Width denoted in characters of <input>.
src url URL of the image to be used as "Submit button" It is available only for the type "image".
step number Mentions legal number intervals for an input field.
type button, checkbox, color, date, datetime, datetime-local, email, file, hidden, image, month, number, password, radio, range, reset, search, submit, tel, text, time, url, week Type <input> to display.
value text Value of <input> is defined.
width pixels Width of <input> is denoted.

Example Code:

Result :

Fill up the below fields:


Phone no:

Email id:


  • By default, the values will be passed to url if the form is submitted.
  • It must be placed inside the <form>.
  • It acts as an interactive tool in a webpage.
It is available in previous versions of HTML.
It supports both Global Attributes and Event Attributes in HTML5.


It is applicable to all major browsers.

Ask Questions

Ask Question