Run function on change accordion

Good day!
I have an accordion, with 5 children modules. Can i on opening module 2 in accordion, to run a function? Like on change field.

Hello @ixxxl,

Hello @donald.kantik,

The Accordion container does not have an event to detect a section change. As a workaround, you can add an event listener for each section using jQuery:

var container = $(fd.container('Accordion1').$el).find('.nav-link')
for (let i = 0; i < container.length; i++) {
    var tab = container[i];
    tab.addEventListener('click', function() {
        //do something
    }, false);
}
1 Like