How-to articles, tricks, and solutions about JAVASCRIPT

How to Redirect Mobile Devices With JavaScript and CSS

Learn How to Redirect Mobile Devices With JavaScript and CSS. 1.JavaScript Method, 2. CSS @media Method. Fast solution for web developers.

How to Build a Hex Color Generator in JavaScript

If you want to create your own color generator using JavaScript, then you’re welcome to our tutorial. In this snippet, we are going to build a hex color generator step by step.

How to Hide and Show a <div>

Read this tutorial and learn several CSS, JavaScript and jQuery methods of hiding and showing the <div> element. Also, you can find examples and try them.

Form Validation Using JavaScript

Incorrect information leads to bad user interactions. So as to prevent this problem, read and learn how to validate forms with the help of JavaScript!

How to Create Range Slider With HTML5 and jQuery

HTML5 range input type allows creating range sliders. Read the tutorial and learn a simple solution including a jQuery code to achieve the desired result!

How to Check if an Element is Present in an Array in JavaScript?

Very often we need to check whether the element is in an array in JavaScript or not. In this snippet, we are going to learn some methods to do that.

How to Display a Message if JavaScript is Turned Off

If you have a content that will not function without JavaScript, you need to display a message with an explanation of the problem. In this snippet, we are going to have a look at 2 simple methods to display the content when JavaScript is turned off.

How to Create a Modal Dialog Box with CSS and JavaScript

Learn how to create Modal Dialog with adding a bit of Javascript to your code. Create your code step by step and find examples!

How and When to Write Comments in Javascript

There are 2 types of JavaScript comments: single-line and multi-line. See when to use them with examples, and also use comments to prevent execution when testing alternative code.

How to Disable Text Selection, Copy, Cut, Paste and Right-click on a Web Page

Learn the ways of how to disable text selection highlighting, how to disable copy, cut and paste, how to disable right-click. See example with CSS, JavaScript and jQuery.

How To Add New Elements To A JavaScript Array

To add new elements you can use the following JavaScript functions: push() unshift(), concat() function or splice(). See examples.

How to Declare and Initialize an Array in JavaScript

Read this tutorial and learn the two basic methods of declaring and initializing an Array in JavaScript. Also, read about the differences of the methods.

How to Convert String to Number in JavaScript

There are several methods of converting a string into a number: parseInt() #; parseFloat() #, Number() #, etc. See examples.

How to Loop through an Array in JavaScript

The most common ways to loop through an array in JavaScript are the for, for/in and while loops. See how to use them. Examples.

How to Remove an Element from an Array in JavaScript

Read this tutorial and learn what several useful Array methods exist that will help you remove the specified element from an Array in JavaScript easily.

How to Check If a String Contains Another Substring in JavaScript

Read this tutorial and learn several methods used to check if a string contains another substring in JavaScript or not. Read information and see examples.

How to Get Current URL in JavaScript

Read and learn how to get the current URL in JavaScript by using Location object properties. Also, gain an understanding about URL and its components.

How to Redirect a Web Page with JavaScript

To redirect a URL page with Javascript you need to set the window.location object. Learn how to do it.

4 5 6 7 8