Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Front End Technology Articles
Page 13 of 652
HTML DOM source object
The HTML DOM source object represents the HTML element in the Document Object Model. The element is used to specify multiple media resources for media elements like , , and . We can create and access source elements using DOM methods like createElement() and getElementById() respectively. The source object allows developers to dynamically add media sources to enhance browser compatibility by providing alternative formats for different devices and browsers. Syntax Following is the syntax for creating a source object − var sourceElement = document.createElement("SOURCE"); Following is the syntax for accessing an ...
Read MoreHTML DOM Span object
The HTML DOM Span object represents the HTML element in the Document Object Model. The element is an inline container used to group text or other inline elements for styling or scripting purposes. We can create new span elements dynamically using JavaScript or access existing ones to manipulate their content and properties. Syntax Following is the syntax for creating a span object − var spanElement = document.createElement("SPAN"); Following is the syntax for accessing an existing span object by ID − var spanElement = document.getElementById("spanId"); Following is the syntax ...
Read MoreHTML DOM Storage Event
The HTML DOM storage event is triggered when changes occur in the browser's storage areas (localStorage or sessionStorage). This event fires when another window, tab, or frame modifies the storage, making it useful for synchronizing data across multiple windows of the same origin. The storage event is particularly valuable for creating real-time communication between different browser windows or tabs without requiring server-side communication. It only triggers when the storage change originates from a different browsing context, not from the current window itself. Syntax Following is the syntax for adding a storage event listener − window.addEventListener("storage", ...
Read MoreHTML DOM Storage getItem() method
The HTML DOM Storage getItem() method is used to retrieve the value of a specific item from web storage by providing its key name. If the key exists, it returns the stored value as a string. If the key doesn't exist, it returns null. The getItem() method works with both localStorage (persistent storage) and sessionStorage (temporary storage that expires when the tab closes). Syntax Following is the syntax for the Storage getItem() method − localStorage.getItem(keyname); OR sessionStorage.getItem(keyname); Parameters The getItem() method accepts a single parameter − ...
Read MoreHTML DOM Storage length property
The HTML DOM Storage length property returns the number of key-value pairs stored in the browser's storage object. This property works with both localStorage and sessionStorage objects, providing a simple way to count stored items. Syntax Following is the syntax for the Storage length property − localStorage.length sessionStorage.length Return Value The length property returns an integer representing the number of items currently stored in the storage object. If no items are stored, it returns 0. Example − localStorage Length Following example demonstrates how to get the number of ...
Read MoreHTML DOM Storage setItem() method
The HTML DOM Storage setItem() method is used to create or update a key-value pair in web storage. This method stores data in either localStorage (persistent across browser sessions) or sessionStorage (temporary for the current session) by specifying a key name and its corresponding value. Syntax Following is the syntax for the Storage setItem() method − localStorage.setItem(keyname, value); OR sessionStorage.setItem(keyname, value); Parameters The setItem() method accepts two parameters − keyname − A string representing the key name under which the data will be stored. ...
Read MoreHTML DOM del dateTime Property
The HTML DOM del dateTime property is associated with the HTML element and specifies when text content was deleted from the document. This property corresponds to the datetime attribute and provides a machine-readable timestamp indicating the date and time of deletion. Syntax Following is the syntax for setting the dateTime property − delObject.dateTime = "YYYY-MM-DDThh:mm:ssTZD" Following is the syntax for getting the dateTime property − var dateTimeValue = delObject.dateTime Parameters The dateTime property accepts a string value in the following format − YYYY − Four-digit year ...
Read MoreHTML DOM Input Radio autofocus property
The HTML DOM Input Radio autofocus property is associated with the HTML element's autofocus attribute. This property sets or returns whether a radio button should automatically receive focus when the page loads. Syntax Following is the syntax for setting the autofocus property − radioObject.autofocus = true|false Following is the syntax for getting the autofocus property − var focusState = radioObject.autofocus; Parameters The autofocus property accepts boolean values − true − The radio button will automatically get focus when the page loads. false − The radio button ...
Read MoreHTML DOM Input Radio defaultChecked Property
The HTML DOM Input Radio defaultChecked property determines whether a radio button was checked by default when the page first loaded. It returns true if the radio button has the checked attribute in the HTML markup, otherwise it returns false. This property reflects the initial state, not the current checked state. Syntax Following is the syntax for the Radio defaultChecked property − radioObject.defaultChecked Return Value The defaultChecked property returns a Boolean value − true − If the radio button has the checked attribute in HTML false − If the radio button ...
Read MoreHTML DOM Input Radio name Property
The HTML DOM Input Radio name property is used for setting or returning the name attribute of a radio button input field. The name attribute is crucial for identifying form data after submission to the server and for grouping radio buttons together so only one can be selected at a time. Syntax Following is the syntax for setting the name property − radioObject.name = "name" Following is the syntax for getting the name property − var name = radioObject.name Parameters The name parameter is a string that specifies the ...
Read More