-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select doesn't properly support onchange event. #11
Comments
Hey @SENTINELITE, thanks for expressing interest in the components. Each component currently exposes a custom
Here is a usage example. <!DOCTYPE html>
<html>
<head lang="en-gb">
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/gh/geekyeggo/sdpi-components@v2/dist/sdpi-components.js"></script>
</head>
<body>
<sdpi-item label="Select">
<sdpi-select>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</sdpi-select>
</sdpi-item>
<script type="text/javascript">
document.querySelector("sdpi-select").addEventListener('valuechange', function (ev) {
console.log(ev.target.value); // 1, 2, or 3
});
</script>
</body>
</html> Please let me know if you have questions, and any feedback is appreciated. |
I've also noticed that this event isn't documented anywhere on https://sdpi-components.dev, so I'll be sure to make a note to get that updated. 👍 |
Awesome, thanks for pointing that out, Geeky! I'll give it a go next week! |
I was perusing this as a potential overhaul for my PI, but I currently use the
onchange="funcXYZ(this.value)"
to react to changes when a new selection is made.I can't seem to get it to work?
The text was updated successfully, but these errors were encountered: