Found 2416 Articles for HTML

HTML DOM Input Text readOnly property

AmitDiwan
Updated on 19-Aug-2019 12:36:03

382 Views

The HTML DOM Input Text readOnly property is used for setting or returning if the input text field is read-only or not. The readOnly property makes the element non-editable but it can still be focused by tab or click. If there is a default value inside a read-only element then it is sent to a server on submit.SyntaxFollowing is the syntax for −Setting the readOnly property −textObject.readOnly = true|falseHere, truly represents the text field is read-only while false represents otherwise. The readOnly property is set to false by default.ExampleLet us look at an example for the Input Text readOnly property ... Read More

HTML DOM Input Text placeholder property

AmitDiwan
Updated on 19-Aug-2019 12:33:45

202 Views

The HTML DOM Input Text placeholder property is used for setting or returning the placeholder attribute value of an input text field. The placeholder property is used for giving the web page users a hint about the input element by showing a text inside the input field before the user inputs anything. The placeholder text is greyed by default and isn’t submitted to the form unlike the value property.SyntaxFollowing is the syntax for −Setting the placeholder property −textObject.placeholder = textHere, text represents the placeholder text specifying the hint for the user about the text field.ExampleLet us look at an example ... Read More

HTML DOM Input Text pattern property

AmitDiwan
Updated on 19-Aug-2019 12:31:06

108 Views

The HTML DOM Input Text pattern property is used for setting or returning the pattern attribute of an input text field. It checks the text against a regular expression specified by the pattern property.SyntaxFollowing is the syntax for −Setting the pattern property −textObject.pattern = regexpHere, regexp is a regular expression against which the text field is checked.ExampleLet us look at an example for the text pattern property − Input Text pattern property The username can either be of three numeric characters or 6 alphabet characters from a to g USERNAME: GET PATTERN ... Read More

HTML DOM Input Text object

AmitDiwan
Updated on 12-Nov-2023 11:38:59

1K+ Views

The HTML DOM Input Text object is associated with the element with type “text”. We can create and access an input element with type text using the createElement() and getElementById() method respectively.PropertiesFollowing are the properties for the text object −PropertyDescriptionautocompleteTo set or return the autocomplete attribute value of a text fieldAutofocusTo set or return if the text field should automatically get focus when the page loads.defaultValueTo set or return the text field default value.DisabledTo set or return whether the text field is disabled, or not.FormTo return the reference of the form containing the text fieldmaxLengthTo set or return the ... Read More

HTML DOM Input Text name Property

AmitDiwan
Updated on 19-Feb-2021 05:33:23

101 Views

The HTML DOM Input Text name property is used for setting or returning the name attribute of an input text field. The name attribute helps in identifying the form data after it has been submitter to the server.SyntaxFollowing is the syntax for −Setting the name property −textObject.name = nameHere, name is for specifying the text field name.ExampleLet us look at an example for the text name property −Live Demo Input Text name Property USERNAME: Change the name of the text field by clicking the below button CHANGE NAME    function changeName() {       ... Read More

HTML DOM Input Text maxLength Property

AmitDiwan
Updated on 19-Feb-2021 05:34:52

131 Views

The HTML DOM Input Text maxLength property is used for setting or returning the maxlength attribute of the input text field. The maxLength property specifies the maximum number of characters you can type in a text field.SyntaxFollowing is the syntax for −Setting the maxLength property −textObject.maxLength = integerHere, integer specifies the maximum number of characters that can be typed in the text field.ExampleLet us look at an example for the maxLength property −Live Demo Input Text maxLength Property USERNAME: Increase the maximum number of characters to be entered for the above field by clicking below button CHANGE ... Read More

HTML DOM Input Text form Property

AmitDiwan
Updated on 19-Feb-2021 05:36:31

90 Views

The HTML DOM Input Text form property is used for returning the form reference that contains the input text field. If the input text field is outside the form then it will simply return NULL. This property is read-only.SyntaxFollowing is the syntax for input text form property.textObject.formExampleLet us look at an example for the Input text form property −Live Demo Input Text form Property USERNAME: Get the form id by clicking on the below button GET FORM    function formId() {       var P=document.getElementById("TEXT1").form.id;       document.getElementById("Sample").innerHTML = "The id ... Read More

HTML DOM Input Text disabled Property

AmitDiwan
Updated on 19-Feb-2021 05:38:57

185 Views

The HTML DOM Input Text disabled property is used for setting or returning if the text field should be disabled or not. It uses boolean values with true representing the element should be disabled and false otherwise. The disabled property is set to false by default. The disabled element is greyed out by default and is unclickable.SyntaxFollowing is the syntax for −Setting the disabled property −textObject.disabled = true|false;Here, true=the text field is disabled and false=the text field is not disabled. It is false by default.ExampleLet us look at an example for the Input Text disabled property −Live Demo ... Read More

HTML DOM Input Text defaultValue Property

AmitDiwan
Updated on 19-Feb-2021 05:40:59

387 Views

The HTML DOM Input Text defaultValue property is used for setting or getting the defaultValue of a text field. The defaultValue of an element is the value assigned to the value attribute. The difference between value property and defaultValue property is the latter retains the original default value specified while the value property value changes based on the user input in the input field.SyntaxFollowing is the syntax to set the defaultValue property −textObject.defaultValue = valueHere, “value” is the text field default value.ExampleLet us look at an example for the Text defaultValue property −Live Demo Input Text defaultValue Property ... Read More

HTML DOM Input Text autofocus Property

AmitDiwan
Updated on 19-Aug-2019 11:40:11

101 Views

The HTML DOM input Text autofocus property is associated with the HTML element’s autofocus attribute. This property is used for setting or returning if the input text field should be automatically focused when the page loads or not.SyntaxFollowing is the syntax for −Setting the autofocus property −textObject.autofocus = true|falseHere, true represents the text field should get focus and false represents otherwise. It is set to false by default.ExampleLet us look at an example for the HTML DOM Input text autofocus property − Input text autofocus property USERNAME: CHECK FOCUS    function FocusVal() { ... Read More

Advertisements