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.

The difference between event.stopPropagation() and event.stopImmediatePropagation()

Event bubbling is an incredibly useful feature of JavaScript. But there might come a time when you need to prevent it. You can do that using the stopPropagation() and stopImmediatePropagation() methods.

The difference between event.target and event.currentTarget

Now that we understand event flow in JavaScript, let’s look at some of the properties available to the event object. We’ll start with the difference between the target and currentTarget properties.

Event flow in JavaScript

I was going to write a series of posts about event handling, but LOL, it turns out I didn’t quite understand how event flow works in JavaScript. Let me show you what I learned from my research.