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
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to change the href value of tag after clicking on button using JavaScript?
The href attribute specifies the link's destination, which can be a URL or an anchor point within the same document. Changing the href attribute value allows us to dynamically update the destination of the link, which can be useful in creating interactive web applications. The tag (anchor tag) is used to create hyperlinks in HTML, linking to other web pages or specific locations within the same document. By combining JavaScript with HTML elements, we can modify these links dynamically based on user interactions. In this article, we'll explore how to change the href value of an anchor ...
Read MoreJavaScript Program for Range LCM Queries
LCM stands for the Least Common Multiple, and the LCM of a set of numbers is the smallest positive integer that is divisible by all the numbers in the given set. In this article, we will implement a JavaScript program to handle range LCM queries efficiently. Problem Statement We are given an array of integers and another array of queries. Each query contains a pair of indices representing a range in the original array. For each query, we need to calculate the LCM of all elements within that range. For example, if the array is [1, 2, ...
Read MoreHow to convert Hex to RGBA value using JavaScript?
While designing web pages we use colors to make web pages more appealing and engaging. We commonly use hex code to represent colors but sometimes we need to add transparency to the colors which can be achieved by RGBA values. Hex color values are represented by #RRGGBB and The RGBA color values are represented by rgba(red, green, blue, alpha). Here are a few examples of RGBA and hex values: Input: #7F11E0 Output: rgba(127, 17, 224, 1) Input: #1C14B0 Output: rgba(28, 20, 176, 1) In this article, we will discuss multiple ways to ...
Read MoreJavaScript Program for Range sum queries for anticlockwise rotations of Array by K indices
Anticlockwise rotation of an array means rotating all the elements of the given array to their left side by the given number of indexes. In this article, we will implement a JavaScript program for range sum queries for anticlockwise rotations of the array by k indices. Introduction to Problem In this problem, we are given an array that will contain some integers and another array that will contain the values in the pairwise form. Each pair will be the number of rotations we need for the current query and after a given number of rotations, we will be ...
Read MoreHow to uniquely identify computers visiting web site in JavaScript?
Whenever we create any application or website, we need to uniquely identify computers visiting the website. There are many benefits to uniquely identifying computers. For example, you can provide free trial services when a user visits your website for the first time from a new device. When they visit again, you can ask users to upgrade to premium or subscribe to your application. Here, we will use cookies to identify computers visiting our website. What are Cookies? Cookies allow developers to store user information in the browser. We can send data from the server to the ...
Read MoreHow to Convert CFAbsoluteTime to Date Object and vice-versa in JavaScript?
CFAbsoluteTime is the elapsed time since Jan 1, 2001, 00:00:00 UTC. This is a standard time format on Apple devices. On the other hand, a date object is a built-in object in JavaScript used to represent date and time values. It has many methods for providing formatting and converting date & time from one form to another. The main difference between CFAbsolute Time and JavaScript Date objects is their reference epoch. CFAbsoluteTime counts seconds since January 1, 2001, whereas JavaScript Date objects count milliseconds since January 1, 1970 (Unix epoch). In this tutorial we will learn how to: ...
Read MoreHow to convert decimal to hex in JavaScript?
Converting decimal numbers to hexadecimal is a fundamental programming task, especially in web development where hex color codes are widely used. JavaScript provides built-in methods and allows custom implementations for this conversion. Using toString() method Using Custom Function Using the toString() Method The toString() method converts a number to its string representation in the specified base. Every JavaScript number has this method available. Syntax Number.toString(radix) Parameters radix (optional): An integer between 2 and 36 specifying the base. For hexadecimal conversion, use 16. Return Value Returns a string ...
Read MoreHow to upload file without form using JavaScript?
Sometimes, developers need to upload files without creating traditional HTML forms. This is useful for drag-and-drop interfaces, single-click uploads, or when building custom file upload components. In this tutorial, we'll explore methods to upload files directly using JavaScript. Using FormData() Object and AJAX Request The FormData object allows us to store file data in key-value pairs, similar to form submissions. We can capture files from HTML input elements and send them to the server using AJAX without wrapping them in a form. Syntax let formData = new FormData(); formData.append("file", uploadedFile); $.ajax({ ...
Read MoreDHTML JavaScript
DHTML stands for Dynamic Hypertext Markup Language. DHTML combines HTML, CSS, and JavaScript to create interactive and dynamic web pages. It allows for customization and changes to the content based on user inputs. Earlier, HTML was used to create static pages that only defined the structure of the content. CSS helped in enhancing the page's appearance. However, these technologies were limited in their ability to create interactive experiences. DHTML introduced JavaScript and the Document Object Model (DOM) to make web pages dynamic. With DHTML, the web page can be manipulated and updated in response to user actions, eliminating the ...
Read MoreExplain Chosen and Select2 with Examples
Select2 and Chosen are popular jQuery plugins that enhance HTML select boxes with improved styling, search capabilities, and user-friendly features. Both plugins work with single and multiple select elements, making form interactions more intuitive. Chosen Plugin Chosen is a JavaScript plugin that transforms standard select boxes into user-friendly dropdown interfaces. It's available for both jQuery and Prototype frameworks. Key Features of Chosen User-friendly Interface Users can search by typing instead of scrolling through long lists. Matching is instant, and non-matching options are filtered out automatically. Progressive Enhancement Chosen gracefully degrades to standard HTML select elements ...
Read More