HTML Input Control Elements

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

A key component of interactive web systems, input tags are HTML elements designed to take a specific form of input from users. Different types of input elements can regulate the data entered to fit a specified format and provide security to password entry.

Syntax

  • <input type="" name="" value="">

Parameters

ParameterDetails
classIndicates the Class of the input
idIndicates the ID of the input
typeIdentifies the type of input control to display. Acceptable values are hidden, text, tel, url, email, password, date, time, number, range, color, checkbox, radio, file, submit, image, reset, and button. Defaults to text if not specified, if the value is invalid, or if the browser does not support the type specified.
nameIndicates the name of the input
disabledBoolean value that indicates the input should be disabled. Disabled controls cannot be edited, are not sent on form submission, and cannot receive focus.
checkedWhen the value of the type attribute is radio or checkbox, the presence of this Boolean attribute indicates that the control is selected by default; otherwise it is ignored.
multipleHTML5 Indicates multiple files or values can be passed (Applies only to file and email type inputs )
placeholderHTML5 A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds
autocompleteHTML5 Indicates whether the value of the control can be automatically completed by the browser.
readonlyBoolean value that indicates the input is not editable. Readonly controls are still sent on form submission, but will not receive focus. HTML5: This attribute is ignored when the value of type attribute is either set to hidden, range, color, checkbox, radio, file or button.
requiredHTML5 Indicates a value must be present or the element must be checked in order for the form to be submitted
altAn alternative text for images, in case they are not displayed.
autofocusThe <input> element should get the focus when page loads.
valueSpecifies the value of <input> element.
stepThe step attribute specifies the legal number intervals. It works with the following input types: number, range, date, datetime-local, month, time and week.

Remarks

As with other HTML5 void elements, <input> is self-closing and may be written <input />. HTML5 does not require this slash.

The following are valid input types in HTML:

5

The following are newly introduced input types as a part of HTML 5 standard. Some of these types are not supported by all web browsers. In the case where a type is not supported, the input element will default to the text type.

To check which browsers support which types, you can go to caniuse.com.



Got any HTML Question?