Event Modifiers: preventDefault stopPropagation once
Use pipe-delimited modifiers to change event behavior without extra code.
Modifier Syntax
Append modifiers to the event name with a pipe character.
<form on:submit|preventDefault={save}>preventDefault
Calls event.preventDefault() before your handler runs. No need to do it manually.
All lessons in this course
- on:click on:input on:submit
- Event Modifiers: preventDefault stopPropagation once
- Custom Events with createEventDispatcher
- Forwarding Events with on:click