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 358 of 652
How to set the gap between the columns with JavaScript?
In this tutorial, we will learn how to set the gap between the columns with JavaScript. The readability of lengthy paragraphs or articles is improved by dividing them into multiple columns. The text is divided into multiple columns using the 'column-count' CSS property. There needs to be a space or gap between the columns to make each column separate from the other. To set the gap between the columns with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Using the style.columnGap property ...
Read MoreHow to add many Event Handlers to the same element with JavaScript HTML DOM?
When building interactive web applications, you often need to handle multiple events on the same element. For example, a button might respond to both clicks and hover events. JavaScript provides several approaches to attach multiple event listeners to a single DOM element efficiently. Using Multiple addEventListener Methods Using Array.forEach() for Event Registration Using Multiple addEventListener Methods The addEventListener method is the standard way to attach event handlers in JavaScript. You can call it multiple times on the same element to register different event types, each with their ...
Read MoreHow to define the number of nodes in a node list with JavaScript HTML DOM?
In this tutorial, we are going to learn how can we find the number of nodes present in a node list in JavaScript. To perform the specific operation, we need to use the HTML DOM which helps us to work with the object model of the webpage. Now let us first understand what a node is and what is a node list in HTML. Everything in an HTML document including element, text, attribute as well as the whole document is a node. Every small element present in an HTML document is part of the navigation tree of an HTML ...
Read MoreSet how many columns an element should span across with JavaScript.
In this tutorial, we will learn to set how many columns an element should span across with JavaScript. Dividing long paragraphs or articles into many columns improves their readability. The 'column-count' CSS property divides the text into numerous columns. Set the columnSpan property to all if you want the columns to span across in JavaScript. To set how many columns an element should span across with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Set the columnSpan property Use the style.setProperty method ...
Read MoreDifference between window.location.href, window.location.replace and window.location.assign in JavaScript?
The window object includes the location object in JavaScript, which provides three different methods for navigating between pages. Each method has distinct behavior regarding browser history and navigation. window.location.href The href property gets or sets the complete URL of the current page. When assigned a new value, it navigates to that URL and adds an entry to the browser's history stack. Example Click below to get the complete URL of the page. Get Current URL ...
Read MoreWhich is the best JavaScript compressor?
JavaScript compressors reduce file sizes by removing unnecessary whitespace, comments, and optimizing code structure. Here are the best options available for different needs. Google Closure Compiler Google Closure Compiler is one of the most powerful JavaScript optimization tools. It parses JavaScript, analyzes it, removes dead code, rewrites inefficient patterns, and minimizes the output. Unlike simple minifiers, it performs advanced optimizations like function inlining and variable renaming. Original JS function add(a, b){ return a + b; ...
Read MoreHow to set the length of the item relative to the rest with JavaScript?
Use the flex property in JavaScript to set the length of flex items relative to each other. The flex property controls how much space a flex item should take up within a flex container. Syntax element.style.flex = "value"; The flex value can be a number (flex-grow), or a combination of flex-grow, flex-shrink, and flex-basis values. Example #box { ...
Read MoreHow to set the left margin of an element with JavaScript?
In this tutorial, we will learn how to set the left margin of an element with JavaScript. Margin is the space around an element outside its border. The margin of an element can be on all sides, such as: left, right, top, and bottom. Use the marginLeft property in JavaScript to set the left margin. In this tutorial, we will discuss two approaches to setting the left margin − Using the marginLeft property Using the setProperty method Using the marginLeft property to set the left margin of an ...
Read MoreHow to set the initial length of a flexible item with JavaScript?
In this tutorial, we will learn how to set the initial length of a flexible item with JavaScript. Flexbox is a one-dimensional layout model that distributes space among items in an interface and provides flexible item alignment properties. It creates flexible items. Use the flexBasis property in JavaScript to set the initial length of a flexible item. In this tutorial, we will see two approaches to setting the initial length of a flexible item: Using the property style.flexBasis Using the method style.setProperty Using the style.flexBasis Property The style flexBasis is a flexbox property ...
Read MoreHow to set the type of cursor to display for the mouse pointer with JavaScript?
In this tutorial, we will learn to set the type of cursor for the mouse pointer with JavaScript. To set the type of cursor, use the cursor property in JavaScript. It allows you to change the cursor on the button click. We can even change the type of cursor by using JavaScript. Different types of cursors have different meanings. There are many styles of cursors that can use on our webpage. Let us look at how to set the type of cursor to display for the mouse pointer with JavaScript. Using the Style cursor Property The ...
Read More