Adding a bubbling event listener


show more Adding a bubbling event listener provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Enhancing the DOM show less
please wait ...

Adding a bubbling event listener

So let's go ahead and work on this project. Right now I'm on the artist's page of this website. And what I want to do is target this section right here with the art from each artist. I need to make sure that I create a node that targets this area right here. And then add a listener for that node that checks for a click. If one of these images is clicked then we're going to execute some code. So I'm going to switch over to my code and show you that this is a very simple list right here, that has image text inside each list item.

So right now my java script code is completely empty. First I will start off by creating a sell executing function. So just protect any of our local variables from anything else running in our page. So start by creating a variable called myNode and then I'm going to set it to document.querySelector and I'm going to target a section in my page. Now what do I need to target? Let's go back into this page and pull up the...

Adding a bubbling event listener
Video duration: 4m 11s 2h 3m Intermediate

Viewers:

Adding a bubbling event listener provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Enhancing the DOM

Subjects:
Developer Web
Software:
HTML JavaScript
Author:
please wait ...