Whats the total number of (s in:
Q: How to use Expandable sections in LWC? I am using Expandable sections in my project. All works fine but when I click the expand (left) icon, it changes to (down) icon to expand the section. But when I refresh the page, it again becomes (left) icon with section expanded (Image)
Code HTML
<template>
    <div class=slds-section slds-is-open data-id={id}>
        <!--section header-->
        <h3 class=slds-section__title>
            <button type=button aria-controls={id} class=slds-button slds-section__title-action data-buttonid={id}
                onclick={toggleSection}>
                <lightning-icon icon-name=utility:switch alternative-text=button icon size=x-small
                    class=slds-section__title-action-icon slds-button__icon_left></lightning-icon>
                <span class=slds-truncate title={label}>{label}</span>
            </button>
        </h3>
        <!--section body-->
        <div class=slds-section__content>
            <slot></slot>
        </div>
    </div>
</template>

Code - JS
import { LightningElement, api } from lwc;
export default class ExpandableSection extends LightningElement {
    @api id;
    @api label;

    toggleSection(event) {
        let buttonid = event.currentTarget.dataset.buttonid;
        let currentsection = this.template.querySelector([data-id= + buttonid + ]);
        if (currentsection.className.search(slds-is-open) == -1) {
            currentsection.className = slds-section slds-is-open;
        } else {
            currentsection.className = slds-section slds-is-close;
        }
    }
}



user
The passage contains eight "("s.
assistant