Articles on Trending Technologies

Technical articles with clear explanations and examples

Internet Explorer unable to render any kind of background color for the element.

Samual Sam
Samual Sam
Updated on 15-Mar-2026 247 Views

Internet Explorer has limitations with HTML5 semantic elements and CSS styling. Here are solutions to common rendering issues in IE. Problem: IE11 Doesn't Support Element Internet Explorer 11 does not recognize the HTML5 element by default. This causes styling and layout issues. Solution: Create the Element with JavaScript Use JavaScript to register the element with IE's DOM: // Create main element for IE compatibility document.createElement('main'); Add CSS Display Property After creating the element, define its display behavior with CSS: main { ...

Read More

DataTransfer object in HTML5

Jennifer Nicholas
Jennifer Nicholas
Updated on 15-Mar-2026 581 Views

The DataTransfer object is a key component of HTML5 drag and drop functionality. It provides methods to store and retrieve data during drag operations and control the visual feedback shown to users. Accessing the DataTransfer Object All drag and drop event handlers receive an Event object with a readonly dataTransfer property that returns the DataTransfer object associated with the event: function dragStartHandler(event) { let dataTransfer = event.dataTransfer; // Use dataTransfer methods here } Key DataTransfer Methods The DataTransfer object provides several important methods: ...

Read More

Style the numbering characters in an ordered list with CSS

Samual Sam
Samual Sam
Updated on 15-Mar-2026 574 Views

The list-style-type property allows you to control the appearance and style of numbering characters in ordered lists. This CSS property offers various numbering formats including decimal, roman numerals, letters, and more. Syntax list-style-type: decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none; Common list-style-type Values Value Description Example Output decimal Default numbers 1, 2, 3 lower-roman Lowercase Roman numerals i, ii, iii upper-roman Uppercase Roman numerals I, II, III lower-alpha Lowercase letters a, b, c upper-alpha Uppercase letters A, B, ...

Read More

Clearing the elements of the Queue in Javascript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 529 Views

We can clear all elements from a queue by reassigning the container to an empty array. This is the most efficient way to remove all queue elements at once. Syntax clear() { this.container = []; } Example Here's a complete example showing how the clear method works with a queue implementation: class Queue { constructor(maxSize = 10) { this.container = []; this.maxSize = maxSize; ...

Read More

How to execute a cube of numbers of a given array in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 2K+ Views

To calculate the cube of each number in an array, you can use several approaches. The most common methods involve iterating through the array and applying the cube operation (n³) to each element. Using a for Loop The traditional approach uses a for loop to iterate through the array and replace each element with its cube: var numbers = [1, 2, 3, 4, 5]; // Calculate cube of each element for (var i = 0; i ...

Read More

How to hide/show HTML elements in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 2K+ Views

JavaScript provides several ways to hide and show HTML elements by manipulating their CSS properties. The most common approach is using the display property with values like none (to hide) and block (to show). Hiding an Element To hide an element, set its display property to none. This removes the element from the document flow completely. Example In the following example, clicking the "Hide Me" button hides the paragraph text: Using JavaScript to hide HTML elements. Showing an Element ...

Read More

How to programmatically set the value of a select box element using JavaScript?

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 1K+ Views

We can set the value of a select box using JavaScript by accessing the element and changing its value property. This is useful for dynamically updating form selections based on user interactions or application state. HTML Setup First, let's create a select element with multiple options: Select Apple Strawberry Cherry Guava Method 1: Using querySelector and value Property The most common approach is to use querySelector to find the element and ...

Read More

Add class (odd and even) in HTML via JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 748 Views

JavaScript provides several ways to add CSS classes to HTML elements based on odd and even positions. You can use CSS nth-child selectors or JavaScript to dynamically add classes to elements. Method 1: Using CSS nth-child Selectors The simplest approach is using CSS nth-child(odd) and nth-child(even) selectors to style elements directly: Odd Even Classes .subjectName:nth-child(odd) { ...

Read More

How to join two arrays in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 372 Views

In JavaScript, there are several methods to join two arrays together. The most common approaches are using the concat() method and the spread operator. Using concat() Method The concat() method creates a new array by merging two or more arrays without modifying the original arrays. Join Arrays with concat() Join Arrays using concat() Join Arrays ...

Read More

Pad a string using random numbers to a fixed length using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 501 Views

We need to write a function that takes a string and a target length, then pads the string with random numbers until it reaches the specified length. This is useful for creating fixed-length identifiers or codes. How It Works The function uses recursion to add random digits (0-9) to the end of the string until it reaches the target length. Each recursive call generates a new random digit using Math.random(). Implementation const padString = (str, len) => { if(str.length < len){ const random ...

Read More
Showing 17571–17580 of 61,299 articles
Advertisements