JavaScript · Middle · Question 42 of 75

How does stopPropagation differ from stopImmediatePropagation?

Explanation

stopPropagation stops propagation to other elements, but the remaining handlers on the current element still run. stopImmediatePropagation stops them too. Only preventDefault cancels the default action. Don't overuse stopping propagation - it breaks delegation.

Further reading

Problem with a question

JavaScript · Middle · question 42

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz