DOM Event Delegation Flashcards
1
Q
What is theevent.target?
A
Object that the event is working on
2
Q
Why is it possible to listen for events on one element that actually happen its descendent elements?
A
The bubble event
3
Q
What DOM element property tells you what type of element it is?
A
The tagName property
4
Q
What does theelement.closest()method take as its argument and what does it return?
A
It takes in a css selector as an argument and returns the closest parent
5
Q
How can you remove an element from the DOM?
A
remove( ) method
6
Q
If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?
A
Add the event listener to parent