DOM Input Text Object
The Text object represents a text-input field in an HTML form.
For each <input type="text">
tag in an HTML form, a Text object is created.
The Input Text object can be accessed by searching through the elements[] array of the form, or by using document.getElementById().
Properties
Property | Description |
---|---|
alt |
Sets or returns an alternate text to display if a browser does not support text fields |
defaultValue |
Sets or returns the default value of a text field |
disabled |
Sets or returns whether or not a text field should be disabled |
form |
Returns a reference to the form that contains the text field |
maxLength |
Sets or returns the maximum number of characters in a text field |
name |
Sets or returns the name of a text field |
readOnly |
Sets or returns whether or not a text field should be read-only |
size |
Sets or returns the size of a text field |
type |
Returns the type of form element a text field is |
value |
Sets or returns the value of the value attribute of a text field |
Methods
Method | Description |
---|---|
select() |
Selects the content of a text field |
Standard Properties and Methods
This object also supports the standard properties and methods.
Standard Events
This object also supports the standard events.