addEventListener() and you!

Event Delegation

What is it? Well I can tell you it is great! Gone are the days of an onMouseOver event watcher on every list item or span on your page. Now you can tell the parents to pay attention to their kids by reminding them to listen to the conversations they little ones are having and reacting appropriately. We do this by using  addEventListener. This brilliant function does just what it says. This one is easier to explain by example, so here goes.

<div id="parent-div">
<span id="child-1">One</span>
<span id="child-2">Two</span>
<span id="child-3">Three</span>

// Get the element, add a click listener...
document.getElementById("parent-div").addEventListener("mouseover", function(e) {
// is the moused over element!
// If it was a span item
if( && == "SPAN") {
// SPAN item found! Output the ID!
console.log("List item ","child-", ""), " was evented!", e);

It is really as simple as that. Now when any child span is moused over the id number for that child will be sent to the console. You can also use specific classes if you use .matches(“className”). Digging deeper into this has me going down the MouseEvent rabbit hole so I know what my next post will be about! I mean who wouldn’t want to learn about MouseEvent.bubbles! BUBBLES!

Final Days as Student at MakerSquare

I am on my last day as a Student at MakerSquare, I have been accepted as a Fellow (more on that later) but I thought it might be a good time to do some reflecting. First thing that strikes me is how long it seemed at the start and how quickly the time went by. I swear days turned to minutes and weeks to hours. I am amazed at how much I learned in such a short period of time. It has been exponential!

I am also aware that the bonds I have developed need attention if I want them to last a lifetime. I am making it a priority to stay in contact with those I have grown close to. This is easily my weakest area so I hope I can stay on top of it. I will never forget the late nights coding and watching TNG. Even the frustrating moments and mini-conflicts that popped up only seemed to draw me closer to my fellow learners.

Even though I am staying on for a bit longer I am still very excited to see what happens to them next. It will give me a hint as to my own future, more things to look forward too, more struggles, more life! I love you all and can’t wait to see the great things that I am sure you will all do!