I’m working on a wix site using custom HTML and javascript.
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?
Try using the native API with document.querySelector('#html2'). Additionally, avoid using var if not necessary. If it doesn’t work, please check whether the onReady function is functioning correctly.
2
Answers
Try using the native API with
document.querySelector('#html2')
. Additionally, avoid usingvar
if not necessary. If it doesn’t work, please check whether theonReady
function is functioning correctly.Use the Wix text element if you just want to display the text and call,
$w('#html2').text = stardate;
You can use postmessage api to send message to your embedded html and receive it by onmessage in your embedded html code.