Svelte · Junior · Question 22 of 76
How do you prevent a form's default submission in Svelte 5?
- ✓Correct answer: Call
event.preventDefault()inside theonsubmithandler - 2Use the
onsubmit|preventDefaultmodifier - 3Return
falsefrom the markup
Explanation
Event modifiers like |preventDefault belong to the legacy on: directive. With event attributes you handle it in the function.