Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
community creator

What is the HTML <input> type attribute?

Behzad Ahmad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

In HTML, the <type> attribute specifies which <input> element we have to display. The default value is “text”.

Syntax


<input type="value">

Parameters

date: It defines the date control.

time: It defines the entering time of control.

url: It defines the field for typing the url.

week: It defines the week and the year control.

search: It defines the text field for entering a search field.

submit: It defines a submit button.

tel: It defines a field for entering a telephone number.

text: It is the default value that defines the single line text field.

range: It defines the range control.

reset: It defines a reset button.

radio: It defines a radio button.

password: It defines a password field.

file: It defines a “Browse” button and a file-select field.

image: It defines the image as a submit button.

month: It defines the month and the year control.

hidden: It defines a hidden input field.

button: It defines a clickable button.

checkbox: It defines a checkbox.

color: It defines the color picker.

datetime-local: It defines the date and time control.

email: It defines the field for the email address.

number: It defines the field for entering a number.

Code example

The basic HTML code to demonstrate the use of the <input> type: button attribute is shown here:

  • HTML

In this example, we have made a form with the input type button. We can also select the attributes according to our own choice.

RELATED TAGS

html
community creator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring