Forum Discussion
SPFX: Event after all client-side web parts rendered?
Is there an event that fires after all client-side web parts rendered? I want to manipulate the DOM after the Page finished rendering.
Can you describe a bit further what you are trying to do? Are you trying to manipulate the out of the box html that is generated by SharePoint? If so, I would avoid this. The DOM is not an API and you should avoid trying to modify it, especially in SharePoint Online where the HTML and CSS classes change almost monthly.
- Alexander AurasIron Contributor
Hello Beau, thank you for answering! Well, your concern with the changing HTML and CSS is very reasoned. I want to write a Table of Contents web part that consolidates all H2 Headlines on an article page. By clicking on a TOC node the user should jump to an Anchor-Link that I added to the H2 Headlines before. The challange: How do I know, when all the client-side web parts got rendered, so I can start building up my TOC... Got it? :D
Tricky tricky - probably the best way is to ask MS to render anchors with H2 tags bei default.