How to show Page Loading div until the page has finished loading?
There are a lot of ways in which we can show a loading div but we have figured out the most optimal solution for you and that too in pure vanilla JavaScript. We will use the document.readyState property. When the value of this property changes, a readystatechange event fires on the document object....
read more
How to get the child element of a parent using JavaScript ?
In this article, we will learn to get the child element of the parent using JavaScript. Given an HTML document, the task is to select a particular element and get all the child elements of the parent element with the help of JavaScript....
read more
How to create two dimensional array in JavaScript ?
A two-dimensional array in JavaScript is an array of arrays, used to represent data in a matrix or grid format. It’s useful for organizing data in rows and columns, such as tables, spreadsheets, or game boards, facilitating complex data manipulation and storage....
read more
How to Show Images on Click using HTML ?
We’ll learn how to display images when someone clicks on them using HTML. We’ll also use a bit of JavaScript to make our web pages more dynamic. We’ll go through a few easy ways to do this, so you can choose the one that works best for you. Let’s get started!...
read more
File Type Validation while Uploading it using JavaScript
In this article, we will learn how to implement file type validation by checking file extension before uploading it using Javascript. This is a demonstration of client-side validation and is implemented to provide a nice user experience. In some cases, client-side validation is a much better method in comparison to the server-side method as it consumes less time....
read more
How to wait for a promise to finish before returning the variable of a function ?
Here a promise is a returned object from an asynchronous function, and callback methods can be added based on the previous function’s result. It is done for back-to-back execution of functions acting like a queue or chain of functions. So as the functions are in the queue, the functions following it must wait for the previous function’s result....
read more
Validation of file size while uploading using JavaScript / jQuery
Validation of file size while uploading is important to provide a nice user experience. In this article, we will learn how to implement file size validation by checking file size before uploading using Javascript and jQuery....
read more
JavaScript Converting milliseconds to date
To Convert milliseconds to date You can achieve this using the Date object, In this article we will see how to Convert milliseconds to date....
read more
How to store a key=> value array in JavaScript ?
We have given two arrays containing keys and values and the task is to store it as a single entity in the form key => value in JavaScript. In JavaScript, the array is a single variable that is used to store different elements. It is usually used once we need to store a list of parts and access them by one variable. We can store key => value array in JavaScript Object using methods discussed below:...
read more
How to remove spaces from a string using JavaScript?
We will explore how to remove spaces from a string using JavaScript. We’ll take a string as input and then remove all the spaces present in it, returning the resulting string....
read more
How to get the first key name of a JavaScript object ?
Given an object and the task is to get the first key of a JavaScript Object. Since a JavaScript object does not contains numbered index so we use the following approaches to get the first key name of the object....
read more
How to adjust the width and height of iframe to fit with content in it ?
Using iframe tag the content inside the tag is displayed with a default size if the height and width are not specified. thou the height and width are specified then also the content of the iframe tag is not displayed in the same size of the main content. It is difficult to set the size of the content in the iframe tag as same as the main content. So its need to be dynamically set the content size when the content of iframe is loaded on the web page. Because its not possible to set the height and width all the time while the same code execute with a different content....
read more