Skip to content

Commit 927c64f

Browse files
Update static/usage/v8/toggle/helper-error/demo.html
Co-authored-by: Brandy Smith <[email protected]>
1 parent b741840 commit 927c64f

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

static/usage/v8/toggle/helper-error/demo.html

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@
1717
</head>
1818

1919
<body>
20-
<div class="container">
21-
<form id="my-form">
22-
<ion-toggle helper-text="This needs to be enabled" error-text="This field is required"> Wi-Fi </ion-toggle>
23-
24-
<br />
20+
<style>
21+
ion-toggle {
22+
width: 300px;
23+
}
24+
</style>
2525

26-
<ion-button type="submit" size="small">Submit</ion-button>
27-
</form>
26+
<div class="container">
27+
<ion-toggle helper-text="Enable to connect to available networks" error-text="Must be enabled to access the internet" checked> Wi-Fi </ion-toggle>
2828
</div>
2929

3030
<script>
31-
const form = document.getElementById('my-form');
32-
const wifi = form.querySelector('ion-toggle');
31+
const wifi = document.querySelector('ion-toggle');
3332

34-
form.addEventListener('submit', (event) => submit(event));
3533
wifi.addEventListener('ionChange', (event) => validateToggle(event));
3634

3735
const validateToggle = (event) => {
@@ -45,12 +43,6 @@
4543
wifi.classList.add('ion-valid');
4644
}
4745
};
48-
49-
const submit = (event) => {
50-
event.preventDefault();
51-
52-
validateToggle({ detail: { checked: wifi.checked } });
53-
};
5446
</script>
5547
</body>
5648
</html>

0 commit comments

Comments
 (0)