JavaScript Tutorials and Tips

JavaScript is a client-side (browser) web scripting language that allows you to control the DOM (Document Object Model) elements on a web page. In this section, you will find detailed JavaScript tutorials and tips to help you improve your JavaScript knowledge.

How to Check If File Input is Empty with Javascript

If you have an online form on your website or web application which requires users to upload a file, validating the file input field on the client side is a good idea. In this tutorial, I will demonstrate how to use JavaScript to check whether a file input field is empty or not on form submit. Read more...

JavaScript Cookies: How to Create a Cookie with Javascript

You can create HTTP cookies on the devices of users that visit your website with the help of JavaScript. In this tutorial, I will demonstrate how to create cookies with JavaScript by giving some examples. Read more...

JavaScript Copy Text to Clipboard Tutorial

It is now possible to copy text from a web page to clipboard via pure JavaScript, without any third party libraries or addons. In this tutorial, I will demonstrate how to copy text to clipboard using JavaScript. Read more...

How to Refresh a Web Page with JavaScript

One of the useful things that you can do with JavaScript is to refresh (reload) a web page. In this tutorial, I will show you how to refresh a page with JavaScript and talk about some sample cases where it can be used. Read more...

How to Download a File with JavaScript

You can create download links to let your visitors download dynamically generated files from your website or application, using a client side scripting language such as JavaScript. In this tutorial, I will demonstrate how to download files with JS. Read more...

How to Download a Text File with JavaScript

You can prepare a text file for download after it is created using JavaScript and in this tutorial I will demonstrate how to do that by providing a simple example. Read more...

Redirect to Another Page with JavaScript

In this tutorial, I will demonstrate how you can redirect a web page to another page with the help of JavaScript by providing simple examples. Read more...

How to Get Elements By Name in JavaScript

Getting elements by name in JavaScript may sometimes be confusing compared to getting elements by id or class. In this tutorial, I will demonstrate how to get an element by its name attribute value in JavaScript. Read more...