Found 8894 Articles for Front End Technology

How to access HTML elements in JavaScript?

Mayank Agarwal
Updated on 21-Apr-2022 14:15:34

17K+ Views

In HTML, sometimes the user needs to access the HTML elements to display the user different changes. We can support this by using modern-day JavaScript. To facilitate this, we can move ahead and change the HTML element by using the following techniques −Get HTML element by IdGet HTML element by classNameGet HTML element by NameGet HTML element by tagNameGet HTML element by CSS SelectorBelow we have added the demonstration for the above methods.Get HTML element by IdThis method gets the element from a unique ID and lets the user access that element. Users can use the getElementById() method to access ... Read More

Difference Between Static and Const in JavaScript

Mayank Agarwal
Updated on 21-Apr-2022 13:59:45

4K+ Views

Static variables can be defined as a class property that is used in a class and not on the class instance. This type of variable is stored in the data segment area of the memory. The value assigned to these types of variables is shared among every instance that is created in the class.We need to use the static keyword for creating any static entity like a static variable, static function, operators, properties, etc. The value of a static variable is set at the runtime of the application and serves as a global value for the whole application.Example 1In the ... Read More

Difference between addEventListener and on-click in JavaScript

Mayank Agarwal
Updated on 21-Apr-2022 13:42:12

1K+ Views

The addEventListener and the on-click event both listen for an event. Both these event methods record an event and execute a function based on that event whenever a button is clicked. Though there is a difference between both these events work.In this article, we are going to explore the differences between the addEventListener and the on-click function in JavaScript.1. addEventListenerThe addEventListener method uses an event handler to attach it to the specified elementSyntaxelement.addEventListener(event, listener, useCapture);Parametersevent − Event can be defined as any valid JavaScript event. The events are generally used without the on prefix (as used in the onclick method).Listener ... Read More

How to enable JavaScript in Chrome, Firefox, and Safari?

Mayank Agarwal
Updated on 21-Apr-2022 13:30:20

556 Views

JavaScript has become an inevitable part of modern-day websites. Each and every website requires the latest JavaScript support and works flawlessly once allowed. We have a toggle inside every browser to switch on and off the JavaScript on our websites. If JavaScript is not enabled in our browsers, they react abnormally and prevent the user from using most of the functions and events.Therefore, to use the websites efficiently we need to enable JavaScript. Following are the most popularly used browsers. We will be looking to enable JavaScript in these −Google ChromeMozilla FirefoxSafariGoogle ChromePlease follow the below steps to enable JavaScript on ... Read More

How to Create an Area chart using Recharts in ReactJS?

Mayank Agarwal
Updated on 21-Apr-2022 13:26:19

1K+ Views

In this article, are going to explore the Rechart JS Library and implement it in a React application to watch how they are used. Rechart Libraries are specifically used for creating different types of charts over the React Application. Charts that can be built using this library are Line Charts, Bar Charts, Pie Charts, Area Charts, etc.In this tutorial, we will be creating an Area Chart with the required data points and displaying the same to the user. We will define the slices of the Area Chart by using the data property that is defined by the data from the ... Read More

How to Create a Color Picker using HTML, CSS, and JavaScript?

Mayank Agarwal
Updated on 29-Feb-2024 15:07:48

1K+ Views

We can easily create a simple color picker on a palette in Javascript. The primary colors on a color picker are RGB i.e. Red, Green, and Blue. With the help of mixing these colors, we can form any color we want.In this article, we will be learning about how to get the RGB value from the user and form different colors with the help of CSS using the RGB color properties. The color intensity of RGB ranges from 0 to 255 where 0 is the least intensity and 255 is the highest intensity.When the intensity of all the 3 coolers ... Read More

Create a Scatter Chart using Recharts in ReactJS

Mayank Agarwal
Updated on 21-Apr-2022 12:26:35

1K+ Views

In this article, are going to explore the Rechart JS Library and implement it in a React application to watch how they are used. Rechart Libraries are specifically used for creating different types of charts over the React Application. Charts that can be built using this library are Line Charts, Bar Charts, Pie Charts, Scatter Charts, etc.In this tutorial, we will create a Scatter Chart with the required data points and display the same to the user. The dataset for the scatter chart will have x and y coordinate details. Then with the help of a Cartesian product, we will ... Read More

How to Create a Profit and Loss Calculator using HTML, CSS, and JavaScript?

Mayank Agarwal
Updated on 21-Apr-2022 12:16:56

2K+ Views

In this article, we are going to create a calculator using JavaScript We will be using the basic math formulas to calculate the profit and loss. We will be returning the result in percentage along with the actual values.To calculate the Profit and Loss we need two things that are: CP (Cost Price) and SP (Selling Price).Formulas to Calculate Profit and Loss −Profit: SP – CPProfit Percentage: Profit/CP * 100Loss: SP – CPLoss Percentage: Loss/CP * 100Example 1In the example below, we have created a calculator that will calculate the profit and loss percentage as per the cost price and ... Read More

How to create a chart from JSON data using Fetch API in JavaScript?

Mayank Agarwal
Updated on 21-Apr-2022 13:04:04

5K+ Views

In this article, we are going to explore on how to create a chart after fetching the JSON data. To fetch JSON data we use fetch() method of Fetch API. We will first fetch the data and once the data is available we will feed it into the system to create a chart. The Fetch API provides a simple interface for accessing and manipulating HTTP requests and responses.Syntaxconst response = fetch(resource [, init])Parametersresource − This is the resource path from where the data is fetched.init − It defines any extra options such as headers, body, etc.ApproachThe steps can be defined ... Read More

Creating a Simple Calculator using HTML, CSS, and JavaScript

Mayank Agarwal
Updated on 05-Apr-2022 07:10:33

3K+ Views

A Student grade calculator is used for taking the grades input for all subjects and then calculating the percentage based upon the marks of the students. This calculator returns a fairly reliable indicator of student results.The simple formula for calculating grades is:$\text{Percentage}=\frac{\text{Marks Scored}}{\text{Total Marks}}\times 100$We are going to take the inputs using HTML, once the inputs are entered we will call the JS function to calculate the average percentage of these numbers and will return the same to the user.Steps for creating a calculator −We will be taking inputs from the user using the input tag.Once the inputs are taken, ... Read More

Advertisements