Currently browsing JavaScript DOM

Monday, June 13, 2022

DragonflyJS – Vanilla JavaScript Drag and Drop

DragonflyJS is a tiny vanilla JavaScript library that enables sorting (dragging and dropping) functionality with zero dependencies.

Monday, May 16, 2022

How to Implement jQuery slideToggle() in Vanilla JavaScript

If you use jQuery for a handful of effects/animations, here’s a quick JavaScript replacement for jQuery slideToggle(). With small changes,…

Monday, May 16, 2022

How to Create a GDPR Modal Popup Using RoarJS

The script below will check for a localStorage variable, which is the explicit user consent. If the variable exists, the…

Monday, June 13, 2022

RoarJS – JavaScript Alert/Confirm Replacement

RoarJS is a wonderful, responsive, customisable, accessible (WAI-ARIA), zero-dependency, vanilla JavaScript alert/confirm replacement. RoarJS automatically centers itself on the page…

Tuesday, May 17, 2022

In Case You Missed It – My CodePen Snippets, Experiments and Code Samples

This post is an assortment of JavaScript snippets, experiments and code samples created for various projects. They are pretty small…

Monday, May 16, 2022

How to Create an Internationalisation System Using JavaScript

Creating an i18n system in JavaScript can be tricky. The most popular option is to use global variables, but it…

Friday, June 3, 2022

Client-Side JavaScript Pagination

Updated on May 4, 2021 to add a second solution, based on JSON data.Updated on August 30, 2019 to use…

Monday, May 16, 2022

A Quick Introduction to Custom Data Attributes and Vanilla JavaScript

For years, developers have needed a method for adding their own metadata to HTML elements, but no standardized technique existed.…

Tuesday, May 10, 2022

JavaScript Selectors API

Dealing with the DOM can be a very tedious process. Traversing the DOM can quickly clutter your code with nested loops. For…

Tuesday, May 10, 2022

Image Beacons

Using image beacons is one of those popular techniques that you would probably know about without knowing its name. The technique helps…

Tuesday, May 10, 2022

JavaScript Random String Generator

I needed a random string for various purposes. For example, to provide a unique ID to HTML elements via JavaScript.…

Tuesday, May 10, 2022

Load a JavaScript File on the Fly

Similar to my previous article on how to add/inject a CSS stylesheet using Vanilla JavaScript, this is how you load…