I am trying to embed a calendar dynamically via a Wix Code Dynamic Page. I have added a Wix ‘HTML Code’ element to my page and set the ‘Code’ setting to the following:
I need to be able to change the ‘data-id’ attribute on the top div element within the $w.onReady() event. I cannot seem to figure this out.
Also, whenever I try to write the following line of code in this event:
document.getElementById(“calDiv”)
i get the following error: “document is undefined”
are we not allowed or able to use the DOM in this traditional way?
if necessary, can I replace the entire code fragment for the ‘HTML Code’ element? I do not see a property for that in the code editor?
Aha - now I think I understand what you’re trying to do. Sorry, I jumped a bit too quickly before.
I tried your code in an $w.HtmlElement and it worked just fine - but you know that. However, the code in the HtmlElement is sandboxed so it can’t talk back and forth to the page. In order to get around this restriction, you will need to send messages.