WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
TUTORIALS
 

HTML DOM Input Text Object


Input Text Object

The Input Text object speaks to a HTML <input> component with type="text".

Access an Input Text Object

You can get to a <input> component with type="text" by utilizing getElementById():

var x = document.getElementById("myText"); Try it

Tip: You can likewise get to <input type="text"> via seeking through the elements gathering of a form.

Create an Input Text Object

You can make a <input> component with type="text" by utilizing the document.createElement() method:

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

Input Text Object Properties

= Property included HTML5.
Property Description
autocomplete Sets or returns the estimation of the autocomplete quality of a content field
autofocus Sets or returns whether a content field ought to consequently get center when the page loads
defaultValue Sets or returns the default estimation of a content field
disabled Sets or returns whether the content field is impaired, or not
form Returns a reference to the structure that contains the content field
list Returns a reference to the datalist that contains the content field
maxLength Sets or returns the estimation of the maxlength trait of a content field
name Sets or returns the estimation of the name trait of a content field
pattern Sets or returns the estimation of the example trait of a content field
placeholder Sets or returns the estimation of the placeholder characteristic of a content field
readOnly Sets or returns whether a content field is perused just, or not
required Sets or returns whether the content field must be rounded out before presenting a form
size Sets or returns the estimation of the size trait of a content field
type Returns which sort of structure component a content field is
value Sets or returns the estimation of the esteem trait of the content field

Input Text Object Methods

Method Description
blur() Removes center from a content field
focus() Gives center to a content field
select() Selects the substance of a content field

Standard Properties and Events

The Input Text object additionally bolsters the standard properties and events.


Related Pages

HTML tutorial: HTML Forms

HTML reference: HTML <input> tag

HTML reference: HTML <input> type attribute