Svelte · Junior · Question 23 of 76
What does bind:value do?
<script>
let name = $state("");
</script>
<input bind:value={name} />
<p>Hello {name}</p>- ✓Correct answer: Creates a two-way binding: typing updates
name, and changingnameupdates the input - 2Sets the initial value only
- 3Binds the input to a store
Explanation
For checkboxes there is bind:checked, for radio groups bind:group, for <input type="number"> the value is converted to a number.