Articles on Trending Technologies

Technical articles with clear explanations and examples

Execute a script when the media is ready to start playing in HTML?

Sreemaha
Sreemaha
Updated on 16-Mar-2026 203 Views

The oncanplay event in HTML is triggered when the browser has enough data to start playing a media element (audio or video) but may need to stop for further buffering. This event is essential for executing scripts when media becomes playable. Syntax Following is the syntax for the oncanplay event attribute − ... ... You can also use the addEventListener method in JavaScript − element.addEventListener("canplay", function() { // Your code here }); Using oncanplay with Video Element The oncanplay event is commonly used with video ...

Read More

HTML DOM Input Datetime name Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 162 Views

The HTML DOM Input Datetime name property sets or returns the value of the name attribute of an input datetime element. The name attribute is used to reference form data after a form is submitted and identifies the input field in JavaScript. Note: The HTML5 input type="datetime" has been deprecated. Modern browsers use datetime-local instead, but this property works similarly for both types. Syntax Following is the syntax for returning the name value − inputDatetimeObject.name Following is the syntax for setting the name value − inputDatetimeObject.name = "string" Return ...

Read More

How to set horizontal header for a table?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 3K+ Views

Tables in HTML can have horizontal headers and vertical headers. A horizontal header displays column labels across the top of the table, while a vertical header displays row labels down the left side. For horizontal headers, we place all elements inside the first tag of the table. Horizontal vs Vertical Table Headers Horizontal Headers Name Age John 25 Sarah 30 Vertical Headers ...

Read More

Execute a script when the playback position of the media has changed in HTML?

Vrundesha Joshi
Vrundesha Joshi
Updated on 16-Mar-2026 179 Views

The ontimeupdate event in HTML triggers whenever the playback position of a media element changes. This event fires continuously during media playback, including when users seek to different positions, fast forward, rewind, or during normal playback progression. Syntax Following is the syntax for the ontimeupdate event attribute − You can also add the event listener using JavaScript − mediaElement.addEventListener('timeupdate', functionName); How It Works The ontimeupdate event fires approximately every 250 milliseconds during media playback, but this frequency may vary depending on the browser and system performance. The ...

Read More

HTML DOM Input Datetime Object

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 255 Views

The HTML DOM Input Datetime Object represents an HTML input element with type="datetime". This input type was designed to allow users to enter both date and time values. However, it's important to note that the datetime input type has been deprecated in HTML5 and is not supported by most modern browsers, which treat it as a regular text input instead. Note: Modern browsers support datetime-local instead of datetime. The datetime type was removed from the HTML specification because it lacked widespread browser support and had usability issues. Syntax Following is the syntax for creating an input element ...

Read More

Execute a script when the media has started playing in HTML?

Ankith Reddy
Ankith Reddy
Updated on 16-Mar-2026 175 Views

The onplaying attribute in HTML is used to execute a JavaScript function when an audio or video element starts playing. This event is triggered after the media has been paused and is resumed, or when it starts playing for the first time. Syntax Following is the syntax for using the onplaying attribute − ... ... The onplaying attribute can also be used with JavaScript event listeners − element.addEventListener('playing', functionName); Using onplaying with Video Element Example Following example demonstrates how to execute a script when a video starts playing ...

Read More

HTML DOM Input Datetime readOnly Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 125 Views

The HTML DOM Input Datetime readOnly property is used to set or return whether a datetime input field can be modified by the user. When set to true, the input becomes read-only and cannot be edited, while false allows normal user interaction. Syntax Following is the syntax for returning the readOnly property value − inputDatetimeObject.readOnly Following is the syntax for setting the readOnly property − inputDatetimeObject.readOnly = booleanValue Parameters The booleanValue parameter accepts the following values − Value Description true Makes ...

Read More

How do I wrap text in a \'pre\' tag in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 1K+ Views

In this article, we are going to learn how to wrap text in a tag in HTML. The HTML tag is used to display preformatted blocks of text exactly as they appear in the source code, preserving all spaces, line breaks, and indentation. Preformatted text refers to content that has already been formatted and should be displayed without any additional formatting changes by the browser. The tag preserves whitespace and uses a monospace font by default, making it ideal for displaying code, poetry, ASCII art, or any text where spacing is important. Syntax Following ...

Read More

Execute a script when the window's history changes in HTML?

Srinivas Gorla
Srinivas Gorla
Updated on 16-Mar-2026 220 Views

The onpopstate event in HTML triggers when the browser's history changes, such as when a user clicks the back or forward button. This event is essential for handling navigation in single-page applications and managing browser history programmatically. Syntax Following is the syntax for the onpopstate event − In JavaScript, you can also add the event listener programmatically − window.addEventListener('popstate', functionName); How It Works The onpopstate event fires when the active history entry changes. This happens when users navigate using browser buttons (back/forward) or when history.back(), history.forward(), or history.go() ...

Read More

HTML DOM Input Datetime required Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 176 Views

The HTML DOM Input Datetime required property determines whether a datetime input field must be filled before form submission. When set to true, the browser prevents form submission if the datetime field is empty and displays a validation message. Syntax Following is the syntax for getting the required property − inputDatetimeObject.required Following is the syntax for setting the required property − inputDatetimeObject.required = booleanValue Parameters The required property accepts a boolean value − Value Description true Makes the datetime field mandatory ...

Read More
Showing 13951–13960 of 61,297 articles
Advertisements