Table of Contents is not working with CMS richtext

I thought maybe TOC script runs earlier before Webflow render the CMS content. then I have put the TOC script before the body tag, but its also not working.

I have test the TOC Attribute with static richtext, its working. when I connect that richtext to CMS, TOC is not working.

Hey @lissanh95! Can you please share a link?

here is the read-only link:

and here is the live link:

TOC atrribute script adding IDs to richtext but not creating link elements. so I added my code to create link elements according to the richtext IDs.

TOC attribute script also working in other pages with CMS richtext. not sure why its not working in this page.

Hey @lissanh95! Sorry for the delay! I see the ToC is working as it should. Did you have to add anything on top?