HTML Articles

Page 15 of 151

HTML DOM Input Text placeholder property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 402 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 provides a hint to users about the expected input by displaying greyed-out text inside the input field before any user input. Unlike the value property, placeholder text is not submitted with the form data. Syntax Following is the syntax for setting the placeholder property − textObject.placeholder = "text" Following is the syntax for getting the placeholder property − var placeholderText = textObject.placeholder Here, text represents ...

Read More

HTML DOM Input Text required property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 214 Views

The HTML DOM Input Text required property is associated with the required attribute of an element. This property allows you to set or check whether a text field must be filled before form submission. When a required field is left empty, the browser prevents form submission and displays a validation message. Syntax Following is the syntax for setting the required property − textObject.required = true|false Following is the syntax for getting the required property − var isRequired = textObject.required; Property Values The required property accepts boolean values − ...

Read More

HTML DOM small object

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 196 Views

The HTML DOM small object represents the HTML element in the Document Object Model. The element is used to display text in a smaller font size, typically for disclaimers, copyright notices, or fine print. Through the DOM, we can dynamically create, access, and manipulate small elements using JavaScript. Syntax Following is the syntax for creating a small object − var smallElement = document.createElement("SMALL"); Following is the syntax for accessing an existing small element − var smallElement = document.getElementById("smallId"); Creating a Small Element The createElement("SMALL") method creates a ...

Read More

HTML DOM source object

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 154 Views

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 More

HTML DOM Span object

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 2K+ Views

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 More

HTML DOM Storage Event

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 255 Views

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 More

HTML DOM Storage getItem() method

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 180 Views

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 More

HTML DOM Storage length property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 217 Views

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 More

HTML DOM Storage setItem() method

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 185 Views

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 More

HTML DOM del dateTime Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 175 Views

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 More
Showing 141–150 of 1,509 articles
« Prev 1 13 14 15 16 17 151 Next »
Advertisements