JavaScript · Junior · Question 41 of 75

What does event.preventDefault() do?

Explanation

For example, a link won't follow its href, a form won't submit, a checkbox won't toggle. Stopping bubbling is event.stopPropagation(); they're different things and often confused.

Further reading

Problem with a question

JavaScript · Junior · question 41

Test yourself

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

Take this quiz