Svelte · Junior · Question 21 of 76

How do you handle a click in Svelte 5?

Explanation

In Svelte 5 events are plain attributes starting with on. The on:click directive is the legacy Svelte 4 syntax.

Further reading

Problem with a question

Svelte · Junior · question 21

Test yourself

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

Take this quiz