As a coding novice, I often wondered what sort of witchcraft occurred behind the scenes that let me navigate through the web, click on pages, resize pages, fill out forms, submit forms, like a post, heart an image…the list goes on. I was somehow expecting that to be a complex programming language on its own, I wasn’t expecting it all to be attributed to something basic sounding as “event handlers”. The crux of the user experience and ultimately the success of apps/websites could be attributed to event handlers, where they’re placed and how they dictate the user experience on a website or app.

In fact, to sound incredibly philosophical (#fakedeep), when you think about it, the bulk of our interactions are with our phones. We use them to plan our days, organise our lives, entertain ourselves…how we perform these activities are dictated by event handlers. You could say that event handlers are tantamount to how we live.

Image for post

My book — ‘Philosophizing with Chuk’ will be out on the 32nd Neveruary. Get yourself a copy!

Ok, back to the technical aspects of event handlers.

How are they setup and how do they work?

At the point of adding an event handler to your JavaScript code, you should have created the HTML foundation/structure of the project/website/app. Event handlers make your code interactive. They’re essentially a “next step” after you’ve created the basic HTML code of your project. You won’t use event handlers to create nodes (HTML elements) ….wellll, technically you can but let’s focus on the basics.

#web-development #flatiron-school #javascript #software-engineering #event-handlers

Event Handling In Javascript: A Beginner’s Guide
1.25 GEEK