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 285 of 652
Difference between location.host and location.hostname in JavaScript
JavaScript's Location object provides access to the current URL's components. One can think of this object as a read-only window into the current location. There are two properties of the Location object that are often confused: location.host and location.hostname. Let's explore their differences with practical examples. location.host The host property returns the hostname and port number (if specified) of the current URL. Location Host Example Current URL Host Information ...
Read MoreWhy split the tag when writing it with document.write()?
In this tutorial, we will learn why to split the tag when writing it with the document.write(). The script tag in HTML is added to execute JavaScript code on the webpage. The JavaScript programs must be enclosed with the script tag to execute. There are many methods in JavaScript that add HTML content to the page, like the document.write() method. The document.write() method is used to delete all the content from the HTML tag or the document and add the content specified in this method to the page. Because of performance degradation and errors in certain conditions, ...
Read MoreHow to add fade-in effect using pure JavaScript?
Introduction We use the fade effect to bring attention to certain parts of our website by gradually increasing or decreasing their opacity. This gradual change in opacity is called the fade-in or fade-out effect. When we gradually increase the opacity, it's known as the fade-in effect and is used to make the selected part of the page become more visible over a chosen amount of time. This creates a smooth transition and helps make our website more dynamic and engaging for our users. In this article, we will be exploring two ways in which we can implement the ...
Read MoreHow can a particular frame be targeted, from a hyperlink, in JavaScript?
HTML frames provide a convenient way to divide a browser window into multiple sections, where each section can load a separate HTML document. JavaScript allows you to target and manipulate specific frames using several methods through the window.frames property and DOM manipulation. The frames property is an array-like object containing all the frames (including iframes) on the current page. Here are the main approaches to target a particular frame: Method 1: Using Frame Index You can target a specific frame by its index position in the frames collection. The first frame has index 0: // ...
Read MoreHow to accept all pending connection requests on LinkedIn using JavaScript?
To accept all pending connection requests on LinkedIn using JavaScript, you would need to use the LinkedIn API and an automation tool. The script would need to navigate to the connection request page and loop through each request, clicking the accept button for each one. This is a very common issue for people who are moderately to highly active on LinkedIn. They get many connection requests every day and must manually click on accept against each request to actually accept them. You can, however make use of JavaScript and the window console to automate this whole process and ...
Read MoreHow to Access element from Table using JavaScript?
To access table elements using JavaScript, you can use methods like document.getElementById() or document.getElementsByTagName() to select the table, then access individual rows and cells. This article demonstrates how to access table rows and create an interactive hover effect. Basic Table Access Methods JavaScript provides several ways to access table elements: By ID: document.getElementById('tableId') - Access a specific table By Tag Name: document.getElementsByTagName('tr') - Access all table rows Table Properties: Use table.rows or table.childNodes to access rows Example: Interactive Table with Hover Effect Let's create a table where rows highlight when you hover over ...
Read MoreHow to implement multiple input checkbox in vanilla JavaScript?
We will learn how to implement multiple input checkbox functionality in vanilla JavaScript. The checkbox input selector will have the following features: Multiple options can be selected using checkboxes Chosen options will be displayed as a separate list with visual indicators Delete icon will be provided against each chosen option to uncheck/remove that option We will implement this functionality using only HTML, CSS, and JavaScript without any third-party libraries. Approach Create an object where keys represent checkbox labels and values (true/false) ...
Read MoreHow to add a tooltip to a div using JavaScript?
To add a tooltip to a div using JavaScript, first create a function that will generate the tooltip content. Next, add an event listener to the div that will call the function and display the tooltip when the div is hovered over. Finally, use CSS to style the tooltip and position it appropriately. A tooltip is a small text box that appears when a user hovers over a specific element on a webpage, such as a button, link, or image. The tooltip typically contains additional information or context about the element that the user is hovering over. Tooltips are ...
Read MoreHow to add an element horizontally in HTML page using JavaScript?
We can use the JavaScript method "createElement" to create a new element. Then, we can use the method "appendChild" to add the element to a parent element on the HTML page. To position the element horizontally, we can use CSS styles such as "display:inline-block" or "float:left/right" on the newly created element. Suppose a situation where we want to depict a graphical representation of a Linked List data structure. Every time the user clicks on a button, a new node, represented by a green circle in our case, should get prepended to the list of nodes horizontally. And the ...
Read MoreHow to Add Commas Between a List of Items Dynamically in JavaScript?
In web development, you often need to display lists of items with commas separating them, like "Item 1, Item 2, Item 3". This can be achieved using CSS or JavaScript to dynamically add commas between list items. HTML Structure Consider the following HTML list structure: Item 1 Item 2 Item 3 Item 4 We'll explore two approaches to add commas between these items dynamically. Using CSS (Recommended) The CSS approach uses the ::before pseudo-element to insert commas before ...
Read More