Search code examples
javascripthtmlvelo

how to update a custom component in wix using javascript


I'm working on a wix site using custom HTML and javascript. enter image description here

Although I know the block's id is html2, I cannot update the innerhtml from the javascript below it. it won't udpate. I know the value is valid. Why can I not access html2.innerHTML?

Thanks


Solution

    1. Use the Wix text element if you just want to display the text and call, $w('#html2').text = stardate;

    2. You can use postmessage api to send message to your embedded html and receive it by onmessage in your embedded html code.