- June 1, 2020 at 6:22 pm #100774
hello – it appears as if using accordion is going to meet our needs perfectly if i can get past this issue.
i need to be able to accessĀ data from the
smart-accordion-itemwhen an item is clicked:
or perhaps there is there a better way to do this?
this.parentNodeĀdoes not appear to work for me.
our smart element will contain thousands of accordion items, each with up to ten clickable items.Ā we need to keep the html as small as possible.June 2, 2020 at 8:17 am #100775
You can get the AccordionItem instance using the
Element.closest()method, like so:
event.target.closest('smart-accordion-item'). Another approach is to use
Event.composedPath()which will return all parents of the current target (including the AccordionItem).
Smart HTML Elements Team
https://www.htmlelements.comJune 2, 2020 at 4:36 pm #100776
event.target.closest('smart-accordion-item').dataset.labelnameĀ Ā š
this is exceptionally useful.Ā you might consider adding this in the documentation.
You must be logged in to reply to this topic.