I have a custom element with a group of checkboxes in it. I was wondering how i would get the value of the checkboxes (which ones are checked) on my main page file?
I have used the Dropdown Custom Element example to get data into the custom element but how do i get it out? Am i missing something?
How to get value from an input inside a Custom Element, without an Event being triggered inside the custom element?
For example, I want to read the value of an input inside the custom element, after clicking a button outside of the custom element.
a button onClick handler that uses setAttribute to change an attribute value of the custom element in accordance to the value you wish to pass. For example you can set a attribute named clickcounter and assign it incrementing value on click.
An .on() to detect the returned value
INSIDE THE CUSTOM ELEMENT
You need to add an attributeChangedCallback to detect the change, and once you detect :
Use dispatchEvent to pass a value back to the outside.