Streaming live at 10am (PST)

Dynamically changing content of Span element with JS


#1

Hi there,

I'm not sure how to post a working example of what I'm trying to achieve, but this line of code is probably found on almost every page on the Internet.

I've got a element with the ID "cost" on my Webflow page. I've got a custom embed on the page with the following code:

<script type="text/javascript">

document.getElementById( 'cost' ).innerHTML = "300";​

</script>

Ideally, this should take the element which currently says "100" as set in Webflow, and change it to "300", but this doesn't happen when I publish and load the site. Am I missing something?

My long-term goal is that extra code will load a dynamic value but for now I just need to get this part working.

Let me know if I can add more depth to this question!


#2