HTMLInputElement: type property - Web APIs | MDN

Value

A string representing the type.

Its possible values are listed in the attribute's input types section.

Example

HTML

html

<input id="input1" type="date" />

JavaScript

js

const inputElement = document.querySelector("#input1");
console.log(inputElement.type); // Output: "date"

Specifications

Specification
HTML
# dom-input-type

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.