Latest Posts

I write about front-end web development. I'm inspired by Nathan Barry's motto, teach everything you know. I also take a lot of inspiration from my friend and mentor, Chris Ferdinandi.

Declare multiple JavaScript variables in one statement

You can declare JavaScript variables one at a time like so: var myName = "Kieran";. But did you know you can declare more than one at a time using a single var statment?

How I built a password toggle script in vanilla JavaScript

When I went through the Vanilla JS Academy, my first project was a script that allows users to toggle the visibility of a password field. I then refactored it to support multiple fields, and finally multiple forms. Here’s how I did it.

How to use event delegation with jQuery

In JavaScript, event delegation is a technique you can use when listening for events in the DOM. Instead of looping through each element and applying an event listener to it, you listen for the event once on a common ancestor, and allow the event to "bubble" up through the DOM. Here’s how to do it if you’re using jQuery.