Found 8591 Articles for Front End Technology

How to trigger the setInterval loop immediately using JavaScript?

Rushi Javiya
Updated on 07-Mar-2023 11:16:20

5K+ Views

The setInteral() method allows us to continuously trigger a callback function after every particular time period. We can pass the callback function as the first parameter to trigger after every time period, and the time period in the milliseconds as a second parameter. The setInterval() method invokes the callback function after a particular number of milliseconds for the first time. Now, the problem is we need to invoke the callback function instantly for the first time at 0 milliseconds, and after that, we need to invoke it continuously in the given time period. Example In the example below, we created ... Read More

How to trigger the onchange event on input type=range while dragging in Firefox?

Rushi Javiya
Updated on 07-Mar-2023 11:14:21

11K+ Views

The range input allows a selection of any value between the particular range of values. Using JavaScript, we can get the input value that users have entered in the range input. The onchage event triggers only when the user releases the mouse key. So, it will not update the value while dragging the range slider. You can face this problem in all browsers, such as chrome, safari, but not only in Firefox. Users can follow the example below to check whether the input value is updated while dragging the range input. Example 1 (Input values will not update while dragging ... Read More

How to trigger the HTML button after hitting enter button in the textbox using JavaScript?

Rushi Javiya
Updated on 07-Mar-2023 11:11:05

5K+ Views

Generally, developers add the submit button to submit the input field's text. However, if they allow users to submit the input value by pressing enter, it improves the UX of the application. Here, we will learn the general way to detect the key press using the key listener event. Afterwards, we can perform any operation whenever the user presses the enter key button. Syntax Users can follow the syntax below to detect whenever the user presses the enter key. input.addEventListener("keypress", function (event) { if (event.keyCode == 13) { // enter pressed ... Read More

How to Trigger a File Download when Clicking an HTML Button or JavaScript?

Rushi Javiya
Updated on 27-Nov-2024 10:18:46

48K+ Views

To trigger a file download when clicking an HTML button or JavaScript, is a very common and important part of web page where users can directly download the file they want by clicking a button or link. We will be understanding four different approaches to achieve this. In this article, we are having a button in our HTML document and our task is to trigger a file download when clicking an HTML button or JavaScript. Approaches to trigger file download Here is a list of approaches to trigger a file download when clicking an HTML button or JavaScript which we ... Read More

How to splice an array without mutating the original Array?

Rushi Javiya
Updated on 07-Mar-2023 11:05:02

4K+ Views

In JavaScript, we can use the splice() method to splice an array. The splice() method inserts or deletes single or multiple elements from the array. We can pass the starting index as the first parameter of the splice() method, from which we can insert or delete the elements. It takes the number of elements to delete from the array as a second parameter and array values as the third parameter to insert into the array. This tutorial will teach us to splice an array without mutating the original array. Mutating the original array means making changes to the array. Whenever ... Read More

How to Create Horizontal and Vertical Tabs using JavaScript?

Rushi Javiya
Updated on 07-Mar-2023 11:01:08

1K+ Views

We can create tabs using HTML, CSS & JavaScript. There can be two types of tabs. One is horizontal tabs, and another is vertical tabs. The tabs allow us to show different contents in very less space as we can show the different content according to the different tabs. We will learn to create horizontal and vertical tabs from scratch using HTML, CSS, and JavaScript. Create horizontal tabs We can show all tabs in a single row by creating horizontal tabs. Also, we can show the content of the selected tab below all tabs. Syntax Users can follow the syntax ... Read More

How to create Hamburger Menu for mobile devices?

Rushi Javiya
Updated on 07-Mar-2023 10:55:12

1K+ Views

The hamburger menu icon has three vertical bars, which the navbar uses to expand and collapse the menu on mobile and tablet devices. This tutorial will teach us to create a hamburger menu from scratch. Here, we will use HTML, CSS, JavaScript, and Bootstrap to create a stylish hamburger menu with a navbar. Steps Users can follow the steps below to create a navbar with a hamburger menu icon. Step 1 − Create a div with a container class containing a navbar and an expandable menu. Step 2 − After that, create a div with a header class inside ... Read More

How to create a domain name finder app in ReactJs?

Shubham Vora
Updated on 06-Mar-2023 15:30:16

575 Views

An online application that enables users to look for accessible domain names using keywords or phrases can be called a domain name finder. It is a helpful tool for companies and individuals wishing to register a new domain name for their websites. Users of this software can look up domain names and display the search results along with other details like cost and availability. To build a ReactJs domain name search app, one must first plan the app's structure and decide which features to include. After configuring the development environment, a search field can be added so that users can ... Read More

How to validate Passport Number is ReactJS?

Shubham Vora
Updated on 06-Mar-2023 15:28:32

5K+ Views

Passport number is very sensitive data, and it always requires to validate. For example, you are taking the user’s data for their identification, and you can use the passport number to validate the user’s identity. Sometimes, the user may enter the wrong passport number. However, you must need to use the database to check whether the passport number matches the user’s real passport number. Still, when a user enters the passport number, you should ensure that the user has entered the correct format. This tutorial will teach us various approaches to validating passport numbers in ReactJS. Use the Validator ... Read More

How to validate Octal number in ReactJS?

Shubham Vora
Updated on 06-Mar-2023 15:09:07

579 Views

There are various types of number representation available such as decimal, hexadecimal, binary, octal, etc. The octal number is a number value by taking the base-8, and it accepts only numbers between 0 to 8. Here, we will learn to validate the octal number. We need to check that all characters of the octal number string should be numeric and between 1 to 8. Use the regular expression to validate octal number in ReactJS The best approach to validate the octal number is using the regular expression. We can use the test() method with the regular expression to ensure ... Read More

Advertisements