Embed Code Expandable Lists

I’m trying to embed a custom code to create expandable lists in one of my help center articles, but it’s not working as expected.

The first code works as expected, but the other lists won’t expand when I click on them. Does anyone know why this might be happening? Does the knowledge base only allow for one embedded code?

Hi @SCruz11

Difficult to know without seeing your code…

It may be a targeting issue - if you add a Custom Module more than once the Javascript will need to target each Module explicitly.

Usually I add an ID Attribute to the Module wrapper to use for targeting.

You can use the Hubl Tag {{ name }} to add a unique ID to every instance of your module on the page.

The trick is to then target the module with your Javascript - which does not accept Hubl. So, I define my targeting variables in the HTML Section in a Script Tag so I can use Hubl for targeting.

Does that help?

Feel free to post a link to an example or send a private message.

Have fun

Mike

Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of Webalite a HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world’s first automated HubSpot Portal Audit that helps you work smarter with HubSpot.

Moderator note: While this solution may not address the original poster’s specific situation, it could be helpful for other community members facing similar challenges.