Latest web development tutorials

HTML DOM Input Text Object

Input Text Object

Input Text object represents the HTML type = "text" of the <input> elements.

Input Text Object Access

You can getElementById () Access type = "text" of the <input> element:

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

Hint: Again, you can find the form elements to access the Input Text Object Collection.

Create Input Text Object

You can create type = "text" by document.createElement () method of the <input> element:

var x = document.createElement ( "INPUT");
x.setAttribute ( "type", "text "); try

Input Text Object Properties

= HTML5 new property.

Attributes description
autocomplete Sets or returns the property value of the autocomplete text field
autofocus After the page loads, or returns whether a text field is set to automatically get focus
defaultValue Sets or returns the default value of the text field
disabled Sets or returns whether to disable the text field
form Returns a text field that contains a reference to the form object
list Returns a text field that contains a reference to the object list of options
maxLength Sets or returns the maximum number of characters in a text field
name Sets or returns the name of the text field
pattern Sets or returns the property value of the text field pattern
placeholder Sets or returns the property value of the placeholder text field
readOnly Sets or returns whether the text field should be read-only
required Sets or returns whether the text field must be filled out before submitting a form
size Sets or returns the property value of the text field size
type Returns the text field form element type
value Sets or returns the value of the property value text field

Input Text Object

method description
blur () Remove focus from the text field
focus () Let the text field gets focus
select () Select the contents of the text field

Standard properties and events

Input Text Object also supports standard attributes and events .


Related Pages

HTML Tutorial: HTML Forms

HTML Reference Manual: HTML <the INPUT> tag

HTML Reference Manual: HTML <the INPUT> of the type attribute