Svelte · Junior · Question 67 of 76
How do you make a checkbox group bound to an array?
<script>
let toppings = $state([]);
</script>
<input type="checkbox" value="cheese" bind:group={toppings} />
<input type="checkbox" value="ham" bind:group={toppings} />- ✓Correct answer: Use
bind:groupon each checkbox with the same array - 2Use
bind:valuewith an array - 3It requires a third-party library
Explanation
For radio buttons bind:group holds a single value instead of an array.