Input Text type Attribute

Definition and Usage

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

对于文本字段,此属性将始终返回 "text".

Example

Find out which type of form element the text field belongs to:

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

Try It Yourself

Syntax

textObject.type

Technical Details

Return Value: String, text field form element type.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support