Dom-event-delegation Flashcards
1
Q
What is the event.target?
A
the element where the event was fired from.
2
Q
Why is it possible to listen for events on one element that actually happen its descendent elements?
A
event bubbling.
3
Q
What DOM element property tells you what type of element it is?
A
.tagName()
4
Q
1A). How can you remove an element from the DOM?
1B).
A
1) . remove();
2) . it takes the selector as an argument and returns the closest ancestor to that selected element.
5
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
adding addevent listener to parent. –> event delegation.