Answer the following questions to gauge your understanding of events:
- Which of these is the second phase of the event lifecycle?
- Capturing
- Targeting
- Bubbling
- (Choose all the correct answers) What does the event object provide us with?
- The type of event that is triggered
- The target DOM node, if applicable
- The mouse coordinates, if applicable
- The parent DOM node, if applicable
Look at this code:
container.addEventListener('click', (e) => {
if (e.target.className === 'box') {
document.querySelector('#color').innerHTML = e.target.style.backgroundColor
document.querySelector('#message').innerHTML = e.target.innerHTML
messageBox.style.visibility = 'visible'
document.querySelector('#delete').addEventListener('click', (event) => {
messageBox.style.visibility = 'hidden'
e.target.remove()
})
}
})
- Which JavaScript features is it using? Select all the answers that apply...