Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Text type property

Input Text type property

Input Text Object Reference The Input Text object

Example

Check which type of form element the text field belongs to:

var x = document.getElementById("myText").type;

x The output is:

text

Try it »


Definition and Usage

The type property returns the form element type of the text field.

For a text field, this property always returns "text".


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the type property


Syntax

textObject

.type

Return Value

Type Description
String The form element type of the text field

Input Text Object Reference The Input Text object