HTML DOM Input Submit Type Property

AmitDiwan
Updated on 19-Feb-2021 05:45:45

123 Views

The HTML DOM Input Submit type property is associated with the input element having its type=”submit”. It will always return submit for the input submit element.SyntaxFollowing is the syntax for submit type property −submitObject.typeExampleLet us look at an example for the submit type property − Input range type Property VOLUME Get the above input element type by clicking the below button GET Type    function rangeType() {       var P=document.getElementById("RANGE1").type;       document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ;    } OutputThis will produce the following output −On clicking the “GET Type” button −

HTML DOM Input Submit Value Property

AmitDiwan
Updated on 19-Feb-2021 05:43:04

198 Views

The HTML DOM Input submit value property is associated with the input element having type=”submit” and the value attribute. It is used to return the value of submit button value attribute or to set it. The value property for submit button changes the text displayed on button as by default the text is “Submit”.SyntaxFollowing is the syntax for −Setting the value property −submitObject.value = text;Here, text is used for specifying the text displayed on the submit button.ExampleLet us look at an example for the input submit value property −Live Demo Input submit Value property UserName: ... Read More

HTML DOM Input Text DefaultValue Property

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

510 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 Disabled Property

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

287 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 Form Property

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

145 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 Maxlength Property

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

211 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 Name Property

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

174 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 Required Property

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

166 Views

The HTML DOM input Text required property is associated with the required attribute of an element. The required property is used for setting and returning if it is necessary to fill some text field or not before the form is submitted to the server. This allows the form to not submit if a text field with required attribute is left empty by the user.SyntaxFollowing is the syntax for −Setting the required property −textObject.required = true|falseHere, true represents the text field must be filled while false represents its optional to fill the field before submitting the form.ExampleLet us look at ... Read More

HTML DOM Source Object

AmitDiwan
Updated on 19-Feb-2021 05:29:24

111 Views

The HTML DOM source object is associated with the HTML element. We can create and access source element using the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a source object −var p= document.createElement("SOURCE");ExampleLet us look at an example for the source object −Live Demo Source object example Add a audio source for the above element by clicking the below element. CREATE    function createSrc() {       var s = document.createElement("SOURCE");       s.setAttribute("src", "sample.mp3");       s.setAttribute("type", "audio/mpeg");       document.getElementById("AUDIO_1").appendChild(s);       document.getElementById("Sample").innerHTML="The ... Read More

HTML DOM Span Object

AmitDiwan
Updated on 19-Feb-2021 05:27:35

2K+ Views

The HTML DOM span object is associated with the HTML element. We can create and access span element using the createElement() and getElementById() method respectively.SyntaxFollowing is the syntax for −Creating a span object −var a = document.createElement("SPAN");ExampleLet us look at an example for the span object −Live Demo Span object example Create a span element by clicking the below button CREATE This is some text inside a p element    function createSpan() {       var s = document.createElement("SPAN");       var txt = document.createTextNode("This is some text inside the span element");     ... Read More

Advertisements