How-to articles, tricks, and solutions about JAVASCRIPT

How to Reload a Page using JavaScript

Read the tutorial and learn information about the method of reloading a page using JavaScript. Also, learn how to make the page be loaded automatically.

How to Make HTTP GET Request in JavaScript

Read the tutorial and learn the how to make an HTTP GET request in JavaScript and make an asynchronous request and handle the response inside event handler.

How to Get the data-id Attribute

Read this tutorial and learn the right ways of getting the data-id attribute using jQuery two methods. Also, learn more information about the two methods.

How to Copy Array Items into Another Array

Read this JavaScript tutorial and learn several useful methods of copying array items into another array. Get to know which method to choose for your case.

How to Find out the Caller Function in JavaScript

Read this JavaScript tutorial and learn the accepted method of finding out the call stack. Get information about the obsolete method of getting the call.

How to Check a Radio Button with jQuery

Read the tutorial and learn the right way of checking a radio button with jQuery. Also, read how to handle with different versions of jQuery while checking.

Colors in JavaScript Console

The console.log() method outputs a message to the web console. Read the tutorial and learn the simplest method of putting a single or multiple styles to it.

How to Remove Style Added with the .css() function Using jQuery

Read this tutorial and learn several ways of removing style added with the .css() function with the help of jQuery. Choose the best method for your case.

How to Get the Value of Text Input Field Using JavaScript

Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.

How to Get the ID of the Element that Fired an Event in jQuery

This tutorial provides you the method of getting the id of the element fired an event in jQuery. Read about the event.target property and this keyword.

How to Convert Object to String

Read this JavaScript tutorial and learn about the fastest methods of converting object into string. Read about JSON.stringify() and toString() methods.

How Get the Current Year in JavaScript

Read this tutorial and learn about the simplest and fastest method of getting the current year a four-digit number using the Date object in JavaScript.

How to Compare Two JavaScrpt Arrays

You can either loop through the arrays or convert them to string and then compare. This tutorial provides several fast methods of comparing two arrays.

How to Create Ajax Submit Form Using jQuery

This tutorial provides several methods of creating an Ajax submit form using jQuery easily. Read about the differences of the GET and POST HTTP methods.

How to Check if the Variable is Undefined

This tutorial provides the method of checking whether the type of the variable is undefined. Read about the differences between undefined and “undefined”.

How to Get the Value of Selected Option in a Select Box

Read the tutorial and learn the methods of getting the value of the selected option in a select box using jQuery. Read about the text() and val() methods.

How to Remove Empty Elements from an Array in Javascript

Read this tutorial and learn the method of removing empty elements from an Array. Also, read about removing falsy elements that include an empty string.

How to Get the Last Item in an Array

Read the tutorial and learn the methods of getting the last item in the array. Get to know the methods and their peculiarities to find the best solution.

The Difference Between Angular-route and Angular-ui-router

Read this Angular.js snippet and get relevant information about the differences and as well as similarities between Angular-route and Angular-ui-router.

The Difference Between Null and Undefined in JavaScript

Read this JavaScript tutorial and get relevant information about the differences between null and undefined data types. Find out their similarities as well.

How to Create an Array Containing 1…N

Read this JavaScript tutorial and get information concerning the problem of creating an Array that contains 1 through to N. Find two methods for solving it.

How to Add Days to JavaScript Date

Read the tutorial and learn a simple method of adding days to JavaScript date with two inbuilt functions used for setting and getting the day of the month.

How to Clear the Canvas for Redrawing

The <canvas> element helps drawing graphics on the fly via JavaScript. Read the tutorial and find the dos and don’ts of clearing the canvas for redrawing.

How to Check if Element is Visible after Scrolling

Read the tutorial and find out one of the methods of checking whether the element is visible after scrolling with jQuery. Also, find about utility function.

How to Randomize (shuffle) a JavaScript Array

In JavaScript, there no any built-in method of shuffling a JavaScript array. Read this tutorial and learn what is the popular method of randomizing arrays.