The HTML input types are used in Form. There are number of HTML input types in HTML language.
Input Type Text
In input type the text you have to write text.
Syntax:
<input type="text" id="username" name="username">
Input Type Password
It defines a password field
Syntax:
<input type="password" id="pwd" name="pwd">
Input Type Submit
It defines a button for submitting form data to a form handler.
Syntax:
<input type="submit" value="Submit">
Input Type Reset
It defines a reset button that will reset all form values to their default values.
Syntax:
<input type="reset">
Input Type Radio
It defines a radio button. You have to select only one choice.
Syntax:
<input type="radio" id="html" name="fav_language" value="HTML">
Input Type Checkbox
It defines a checkbox. You have to select one or more options.
Syntax:
<input type="checkbox" id="vehicle" name="vehicle" value="Bike">
Input Type Button
It defines a button.
Syntax:
<input type="button" onclick="alert('Hello World!')" value="Click Me!">
Input Type Color
It contain color and a color picker show up in the input field.
Syntax:
<input type="color" id="favcolor" name="favcolor">
Input Type Date
It contain date and it display the date picker in input field. You can also use the min
and max
attributes to add restrictions to dates.
Syntax:
<input type="date" id="birthday" name="birthday">
Input Type Email
It contains an email address.
Syntax:
<input type="email" id="email" name="email">
Input Type Image
It display the image and the image specified in the src attribute.
Syntax:
<input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
Input Type File
It defines a file select field and a browse button for file uploads.
Syntax:
<input type="file" id="myfile" name="myfile">
Input Type Hidden
It defines input field hidden
Syntax:
<input type="hidden" id="custId" name="custId" value="3487">
Example: