This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Kai Oliver Reuter
Posted Jun 18 - Read on Facebook

Hi, i have a question. How can i put the following line of code into a framer layer: document.write("<p id='test'>7.000.000</p>")? I want to animate a number with countUp.js. This javascript class requires a html element + an ID.

Thanks guys!


Johannes Eckert

you can change a layer's content with layer.html, which would essentially be your document.write. so just put layer.html = "<p id='blah'></p>"

Kai Oliver Reuter

ok i tried this yesterday also but when i call document.getElementById("blah"), the console only displays "null". Any ideas?

Johannes Eckert

if you look at the DOM tree in your inspector, you should see what you put into the layer.html

Kai Oliver Reuter

thanks for your answer. now i figured out the problem. i put my countUP.js class into a window.onload function and now it works. it was a problem within the DOM tree.

Read the entire post on Facebook