using wa-change on a wa-checkbox #2314
Unanswered
Offbeatmammal
asked this question in
Help
Replies: 1 comment
-
Observing the const checkbox = document.querySelector('wa-checkbox');
checkbox.addEventListener('wa-change', () => {
console.log(checkbox.checked);
}); Example: https://codepen.io/claviska/pen/QwLddQx?editors=0010 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
looking for guidance on the best way to handle this - I have a number of checkboxes on a page and would like to trigger a function when the checkbox changes, and be able to retried both the state of the checkbox and also an arbitary data item from the wa-checkbox
onclick seems to not be great as that triggers twice, and I tried including a wa-change method on the declaration to explicitly call it, but that never runs the javascript
I have tried adding an event listener:
but that's not being super helpful in getting the current checked/not-checked status (or my arbitrary data)
Any pointers on the best way to handle this (either vanilla JS or jQuery)
Beta Was this translation helpful? Give feedback.
All reactions