Found 8894 Articles for Front End Technology

How to combine multiple elements and append the result into a div using JavaScript?

Rushi Javiya
Updated on 19-Jan-2023 09:22:51

7K+ Views

Sometimes, we require to manipulate the HTML elements using JavaScript. So, we can use JavaScript to add or remove HTML elements. This tutorial will teach us to combine multiple HTML elements in a single shot using JavaScript. Sometimes we need to show some HTML elements to users when they click the button or particular event triggers. So, we can use the approaches below to combine multiple elements and append the result into a div element using JavaScript. Use the innerHTML Property The innerHTML, as the name suggests, allows us to set the HTML for any particular element using JavaScript. Using ... Read More

How to close a current tab in a browser window using JavaScript?

Rushi Javiya
Updated on 19-Jan-2023 09:19:02

6K+ Views

We will learn to close the browser window using JavaScript in this tutorial. Suppose users have opened your website in 2 tabs and don’t want to allow it, then you can close one tab automatically using JavaScript. Also, if you have noticed that some web apps automatically open the browser window to capture a face, it closes automatically when you capture the image by clicking the button. It’s all we can do using JavaScript. This tutorial will teach different examples of closing the current tab in a browser window using JavaScript. Note − JavaScript never allows developers to close the ... Read More

How to clone an array in ES6?

Rushi Javiya
Updated on 19-Jan-2023 09:16:08

505 Views

In ES5, we used the concat method to make a copy of the array. Also, some developers used the slice() method by passing 0 as a parameter to slice all elements of the referenced array and create a new array. Example Users can follow the example below to clone the array using the slice() method. We have created array1, which contains the values of different data types. After that, we used the slice() method to make a copy of array1 and store it in the ‘clone’ variable. Using the slice() method to clone the array ... Read More

How to click anywhere on the page except one element using jQuery?

Rushi Javiya
Updated on 19-Jan-2023 09:09:09

5K+ Views

We will learn to check if users have clicked anywhere on the page except one element using JavaScript and jQuery. While working with the modals, we require to close the modal when the user clicks the outside of the modal. So, we can achieve that using various methods of JavaScript or jQuery. Also, there are other use cases where we need to check whether users have clicked on a particular element. For example, when users click outside the dropdown menu, close the dropdown menu; Otherwise, select the option from the dropdown menu. Here, we have different approaches to check if ... Read More

How to check if the input date is equal to today’s date or not using JavaScript?

Rushi Javiya
Updated on 19-Jan-2023 09:05:43

1K+ Views

We learn to check if the input date is equal to today’s date or not using JavaScript in this tutorial. Sometimes, we need to take the date from users in the input field in various formats and check if input date and today’s date match. Here, we will learn two approaches to check the equality of the input date with today’s date. By comparing the year, month, and date separately Users can get the full year, month, and date from the timestamp of the Date object using various methods such as getFullYear(), getMonth(), and getDate(). Also, we can get the ... Read More

How to clear the content of a div using JavaScript?

Rushi Javiya
Updated on 19-Jan-2023 09:02:54

13K+ Views

We will learn to remove all child elements or content of a div element using JavaScript. However, whatever method we learn to clear the div element's content will work with any HTML element. Removing the content of the div element is useful when users want to display some HTML content based on a particular condition or want to replace HTML content. Here, we will explore three approaches to clear the content of a div using JavaScript. Using the replaceChildren() Method The replaceChilderen() method allows developers to replace child elements of a particular HTML element. So, we can create new child ... Read More

How to check the OffscreenCanvas is supported by the Browser or not in JavaScript?

Rushi Javiya
Updated on 19-Jan-2023 10:23:17

326 Views

In HTML, Canvas is very important when we want to show animation or 3D objects on the webpage using only HTML and JavaScript. The offscreenCanvas allows users to render the animations and graphics off-screen. It means when we use the canvas, it interacts with the user via the main thread of the web application, but offscreenCanvas doesn’t. So, we can improve the performance of the application using offscreenCanvas . Before we use offscreenCanvas with any browser, we need to check if it is supported by the Browser or not; Otherwise, we need to use canvas. So, we will learn two ... Read More

What is contextual selector in CSS?

Tanmay Chandhok
Updated on 19-Jul-2023 15:26:00

1K+ Views

Contextual selectors allow the developer to select different types of styles for different parts of the document. In CSS, the developer can either specify styles directly or by making certain classes. The contextual selector will only apply the style to the elements which are specified. A parent-child relationship between elements in the document can be known as context. The contextual selectors will have 2 or more than 2 selectors which are separated. In this article, we are going to have a look at what is a contextual selector in CSS and how can we use it. What is contextual selector ... Read More

Making a Div vertically scrollable using CSS

Tanmay Chandhok
Updated on 18-Jan-2023 18:41:33

461 Views

There is a possibility that the content that we are going to use in our website may be huge and may take a lot of space which means that the other elements of the website might get displaced which can hamper the responsiveness of the website. To avoid such incidence, the user needs to be given scrollable content so that if the user is interested he or she might scroll down to read the whole content. In this article, we are going to have a look at how we can make a div vertically scrollable and what is the property ... Read More

Is it possible to prevent the users from taking screenshot of webpage?

Tanmay Chandhok
Updated on 18-Jan-2023 18:35:08

16K+ Views

While browsing through the internet a user might find the need to capture something in order to present or to show to someone, but sometimes there might be sensitive information on a webpage which the developer might not want the user to screenshot it. The user can press the function key along with windows key and space bar to take a screen shot. In MacOS we would have to use the command and shift and 3 for taking a screenshot. In this article, we are going to have a look at how can we prevent the user from taking a ... Read More

Advertisements