Svelte · Junior · Question 23 of 76

What does bind:value do?

<script>
  let name = $state("");
</script>

<input bind:value={name} />
<p>Hello {name}</p>

Explanation

For checkboxes there is bind:checked, for radio groups bind:group, for <input type="number"> the value is converted to a number.

Further reading

Problem with a question

Svelte · Junior · question 23

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