If you need a Webflow Symbol element inserted to a RichText element, somewhere in the middle - this one's for you!
The RichText can be dynamic or static content, and the page can be a CMS template page or a static page. If we use this code in a CMS template page, we can also give the power of dynamically deciding where the symbol will be placed (before which element inside the RichText).
var symbol = document.getElementById("symID");
var body = document.getElementById("richID");
Takes the symbol and places it inside the element with the "symID" ID right before it's 5th child.
We can do the same and replace the number '5' with a dynamic field, so each dynamic page will have a different outcome.
Automatically insert the current year to any element with the class of 'year'
Using JS to scroll a div (menu) to the current link inside.