Beginner
JavaScript
Q19 / 100
What is event.preventDefault() used for?
Correct! Well done.
Incorrect.
The correct answer is B) Prevents the default browser behavior for an event (e.g., stopping a form submit or link navigation)
B
Correct Answer
Prevents the default browser behavior for an event (e.g., stopping a form submit or link navigation)
Explanation
event.preventDefault() stops default actions like form submission or anchor navigation while still allowing the custom handler to run.
Progress
19/100