Articles on Trending Technologies

Technical articles with clear explanations and examples

How to Render an HTML String Preserving Spaces and Line Breaks?

Tanya Sehgal
Tanya Sehgal
Updated on 16-Mar-2026 459 Views

When creating HTML content, you may need to preserve multiple spaces, tabs, and line breaks exactly as they appear in your source code. By default, HTML collapses multiple whitespace characters into a single space and ignores line breaks. The and tags will not display extra spaces or line breaks as written in your HTML file. This article demonstrates two effective methods to render HTML strings while preserving all original spacing and line breaks. Method Overview Using the HTML Tag Using the CSS white-space Property Using the HTML Tag The ...

Read More

HTML oncontextmenu Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 234 Views

The oncontextmenu event attribute in HTML is triggered when a user right-clicks on an element to open the context menu. This event allows developers to customize behavior when the context menu appears, such as displaying custom menus or preventing the default context menu from showing. Syntax Following is the syntax for the oncontextmenu event attribute − Content The script can be a JavaScript function call or inline JavaScript code that executes when the user right-clicks on the element. Parameters The oncontextmenu event handler receives an event object as a parameter with the ...

Read More

HTML DOM Video duration Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 276 Views

The HTML DOM Video duration property returns the duration of a video in seconds as a numeric value. This read-only property is essential for creating custom video controls, progress bars, and displaying video information to users. Note − For live streams, the duration property returns Infinity because live content has no predefined end time. Syntax Following is the syntax for accessing the duration property − videoObject.duration Return Value The duration property returns a numeric value representing − The length of the video in seconds (for recorded videos) Infinity for live ...

Read More

How to Add a Datepicker in Form using HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 2K+ Views

Forms are a crucial component of any web application, containing input fields for information like names, emails, and dates. A datepicker is an interactive dropdown calendar that allows users to select dates easily without manually typing them. This feature is commonly used for birthdate entries, appointment scheduling, and event planning. In HTML5, adding a datepicker to forms is straightforward using the built-in element, which provides native browser support for date selection. HTML The element with type="date" creates input fields where users can enter dates using either a text box with validation or a visual ...

Read More

HTML DOM Location search Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 208 Views

The Location search property returns or sets the query string portion of a URL, including the leading question mark (?). This property allows you to read the search parameters from the current URL or programmatically modify them. Syntax Following is the syntax for getting the search property − location.search Following is the syntax for setting the search property − location.search = searchString Parameters searchString − A string representing the query parameters, including the leading question mark. For example: "?name=john&age=25" Return Value Returns a string containing the query ...

Read More

HTML DOM Input Range type property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 201 Views

The HTML DOM Input Range type property is associated with input elements having type="range". This property returns the string "range" for range input elements, confirming their input type programmatically. The range input type creates a slider control that allows users to select a numeric value within a specified range. The type property helps identify and validate that an input element is indeed a range slider. Syntax Following is the syntax for accessing the type property of a range input element − rangeObject.type Return Value The type property returns a string value "range" ...

Read More

HTML ondrag Event Attribute

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 231 Views

The ondrag event attribute in HTML is triggered continuously while an element is being dragged. This event fires repeatedly during the drag operation, making it useful for providing real-time feedback or updating the interface while dragging is in progress. By default, HTML images and links are draggable without requiring the draggable="true" attribute. For other elements like , , or , you must explicitly set draggable="true" to make them draggable. Syntax Following is the syntax for the ondrag event attribute − Content Parameters script − JavaScript code to execute when the element ...

Read More

Explain different markup languages other than HTML

Yaswanth Varma
Yaswanth Varma
Updated on 16-Mar-2026 637 Views

Markup languages are computer languages that use symbols or tags to structure, format, and describe relationships between portions of text documents. Unlike traditional programming languages with strict syntax, markup languages are designed to be more human-readable and easier to understand. While HTML is the most widely known markup language for web development, several other markup languages serve different purposes and offer unique capabilities. XML (Extensible Markup Language) XML is a markup language designed to store and transport structured data using custom-defined tags. Unlike HTML, which has predefined tags for presentation, XML allows developers to create their own tags ...

Read More

HTML DOM Input Range value property

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

The HTML DOM Input Range value property is associated with input elements having type="range". It returns or sets the current value of the range slider control. The value can be the default value specified in HTML or a value set by the user dragging the slider. Syntax Following is the syntax for getting the value property − var value = rangeObject.value; Following is the syntax for setting the value property − rangeObject.value = number; Here, number is a numeric value within the range defined by the min and max attributes ...

Read More

HTML DOM Video ended Property

AmitDiwan
AmitDiwan
Updated on 16-Mar-2026 220 Views

The HTML DOM Video ended property returns a boolean value indicating whether a video has finished playing. It returns true when the video has reached its end, and false otherwise. This property is read-only and useful for detecting when video playback is complete. Syntax Following is the syntax for accessing the ended property − videoElement.ended Return Value The ended property returns a Boolean value − true − The video has reached its end false − The video is still playing or paused before the end Example − Checking Video ...

Read More
Showing 13221–13230 of 61,297 articles
Advertisements