What is the difference between stopPropagation() and preventDefault()?
- A stopPropagation halts the event travelling through the DOM; preventDefault cancels the browser's default action
- B They do the same thing
- C preventDefault stops bubbling
- D stopPropagation removes the listener
Answer
stopPropagation halts the event travelling through the DOM; preventDefault cancels the browser's default action
They are unrelated. Preventing a link from navigating requires preventDefault, while stopping an ancestor handler from firing requires stopPropagation.





