Using the <text> Element

Elements of type text create basic single-line text fields. The Try It example in this section will help you make your first text element. Text elements also have many attributes that can be helpful such as list, maxLength, minLength, size, and a few more. The section also introduces client-side validation of text fields which will be covered in detail later.

Technical summary

Value A string representing the text contained in the text field.
Events change and input
Supported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size
IDL attributes list, value
DOM interface

HTMLInputElement

Methods select(), setRangeText() and setSelectionRange().
Implicit ARIA Role with no list attribute: textbox with list attribute: combobox