Input Text type 属性

定义和用法

type 属性返回文本字段是哪种类型的表单元素。

对于文本字段,此属性将始终返回 "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