Access HTML Elements in JavaScript

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

19K+ 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 onClick 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

Enable JavaScript in Chrome, Firefox, and Safari

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

865 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

Create Area Chart Using Recharts in ReactJS

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

2K+ 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

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

Create a Scatter Chart Using Recharts in ReactJS

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

2K+ 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

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

Things to Know Before You Start a Blog

Sharon Christine
Updated on 21-Apr-2022 12:10:44

379 Views

Having a blog is a great idea, because you can share anything you like, and if you are wise you can also earn a decent revenue from your blog. This article provides a general awareness of creating your own blog especially for a beginner so as to begin the blogging process.Defining a BlogBlogs are like journals or like a website that an individual posts about what he/she loves or does and want people to know about. Bloggers use them to express their creativity, their knowledge, or their opinion. It also helps in interacting with readers and provides feedback to the ... Read More

How Internet Use is Affecting Computer Illiterates

karthikeya Boyini
Updated on 21-Apr-2022 11:24:38

202 Views

The term computer illiterate once was a self-depreciating term that was used by many who were from generations that grew up without computers. What began, as a joking term many seniors used to make fun of themselves is now becoming a term that is actually researched and discussed in political circles. With the spread of the Internet, it is becoming more of a necessity than a luxury to have some basic computer skills. However, Internet usage for computer illiterates is something that many major corporations as well as politicians are trying to combat.Influence of Internet on computer illiterates −In today’s ... Read More

Advertisements