Dynamic Accordion Creation

I am creating a dynamic accordion with .innerHTML and the when i try to open the accordion, it does not open/work. I can see the accordion, but it does not open.

var q = document.getElementById(‘Layer Menu’);

    q.innerHTML = TS

I have used the accordion provided in the pinegrow menu to create an accordion and I am now using innerHTML to create an accordion dynamically but the accordion does not open when i select it. How do i make this work? I have searched the web a while to find a solution but i haven’t quite been able to find one. Thanks for the help!

(Reminder: First accordion is not dynamically created)