You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/tutorial/01-svelte/06-bindings/04-group-inputs/README.md
+15-21Lines changed: 15 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -2,34 +2,28 @@
2
2
title: Group inputs
3
3
---
4
4
5
-
If you have multiple inputs relating to the same value, you can use `bind:group` along with the `value` attribute. Radio inputs in the same group are mutually exclusive; checkbox inputs in the same group form an array of selected values.
5
+
If you have multiple `type="radio"` or `type="checkbox"`inputs relating to the same value, you can use `bind:group` along with the `value` attribute. Radio inputs in the same group are mutually exclusive; checkbox inputs in the same group form an array of selected values.
In this case, we could make the code simpler by moving the checkbox inputs into an `each` block. First, add a `menu` variable to the `<script>` block...
15
-
16
-
```js
17
-
/// file: App.svelte
18
-
let menu = ['Cookies and cream', 'Mint choc chip', 'Raspberry ripple'];
19
-
```
20
-
21
-
...then replace the second section:
19
+
...and `bind:group={flavours}` to the checkbox inputs:
0 commit comments