HTML Articles

Page 22 of 151

HTML DOM Span object

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 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 − 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

HTML DOM Storage getItem() method

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 173 Views

The HTML DOM Storage getItem() method is used for obtaining a storage object by passing a given key name. It will return the key’s values and if there is no key with that given name then NULL will be returned.SyntaxFollowing is the syntax for Storage getItem() method −localStorage.getItem(keyname);ORsessionStorage.getItem(keyname);Here, keyname is of type string and represents the name of the item to be obtained.ExampleLet us look at an example for the HTML DOM Storage getItem() method − Storage getItem() method example Create a localStorage item with the name CLICKS to count the number of clicks on the create button ...

Read More

HTML DOM Storage length property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 206 Views

The HTML DOM Storage length property is used for getting the number of items that are present inside the browser’s storage object. The storage object can be a localStorage object or a sessionStorage object.SyntaxFollowing is the syntax for −Storage length property using localStorage object −localStorage.length;Storage length property using sessionStorage objectsessionStorage.length;ExampleLet us look at the example for the Storage length property − Storage length property example Get how many storage items are stored in the local storage object by clicking the below button GET NUMBER    function itemNum() {       var num = localStorage.length;   ...

Read More

HTML DOM Storage setItem() method

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 178 Views

The HTML DOM Storage setItem() method is used for removing a storage object item by passing a given key name.SyntaxFollowing is the syntax for Storage removeItem() method −localStorage.removeItem(keyname, value);ORsessionStorage.removeItem(keyname, value );Here, keyname is of type string and represents the key name used for getting the value. The second parameter value represents the new value that will replace the old value.ExampleLet us look at the example for the Storage setItem() method − Storage setItem() method example Create the localstorage item by clicking the below button CREATE Display the localstorage item by clicking the below button DISPLAY   ...

Read More

HTML DOM del dateTime Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 169 Views

The HTML DOM del dateTime property associated with the HTML element is used for telling the user when some text on the website was deleted. It tells the date and time of when the text was deleted.SyntaxFollowing is the syntax for −Setting the dateTime property −delObject.dateTime = YYYY -MM-DDThh:mm:ssTZDHere, YYYY=years , MM=months , DD=days, T=separator or a space, hh=hours , mm=minutes, ss=seconds, TZD=Time zone designatorExampleLet us look at an example for the del dateTime property − del dateTime property example    #Sample{color:blue}; del dateTime property example Some text has been deleted Click the ...

Read More

HTML DOM Del object

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 187 Views

The HTML DOM Del object is associated with the HTML element. It is used to represent the element. Using the Del object we can create and access a elememt.PropertiesFollowing are the properties for the Del object −Sr.NoProperties & Description1citeTo set or return the cite attribute value of the deleted text.2dateTimeTo set or return the datetime attribute value of the deleted text.SyntaxFollowing is the syntax for −Creating a Del object −var p = document.createElement("DEL");ExampleLet us look at an example for the HTML DOM Del object − del object example Click on the below button to create ...

Read More

HTML DOM Input Radio defaultChecked Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 173 Views

The HTML DOM Input Radio defaultChecked property checks whether the radio button has been checked by default or not. It returns true if the radio button is checked otherwise it will return false.SyntaxFollowing is the syntax for Radio defaultChecked property −radioObject.defaultCheckedExampleLet us look at an example of the Radio defaultChecked property − Input Radio defaultChecked property FRUIT: Mango CHECK    function checkDefault() {       var c = document.getElementById("Mango").checked;       document.getElementById("Sample").innerHTML = "The button default checked value is "+c;    } OutputThis will produce the following output −On ...

Read More

HTML DOM Input Radio name Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 204 Views

The HTML DOM Input radio name property is used for setting or returning the name attribute of an input radio field. The name attribute helps in identifying the form data after it has been submitted to the server. JavaScript can also use the name attribute to refer form elements to manipulate later on.SyntaxFollowing is the syntax for −Setting the name property.radioObject.name = nameHere, name is for specifying the radio button name.ExampleLet us look at an example for the radio name property − Input radio name Property FRUIT: Orange Change the name of the above radio button ...

Read More

HTML DOM Input Radio object

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 245 Views

The HTML DOM Input radio object is associated with the element with type “radio”. We can create and access an input element with type radio using the createElement() and getElementById() method respectively.PropertiesFollowing are the properties of the Input Radio object −Sr.NoProperties & Description1AutofocusTo set or return if the radio button should get focus automatically when the page loads or not.2CheckedTo set or return the radio button checked state.3defaultCheckedTo return the checked attribute default value for a radio button4defaultValueTo set or return the radio button default value.5DisabledTo set or return whether the radio button should e disabled, or not6FormTo return ...

Read More

HTML DOM Input Radio required property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 266 Views

The HTML DOM input radio 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 check some radio button or not before the form is submitted to the server. This allows the form to not submit if a radio button with required attribute is left unchecked by the user.SyntaxFollowing is the syntax for −Setting the required property.radioObject.required = true|falseHere, true represents the radio button must be checked while false represents its optional to check the radio button before submitting the form.ExampleLet us look at ...

Read More
Showing 211–220 of 1,508 articles
« Prev 1 20 21 22 23 24 151 Next »
Advertisements