Set HTML of a box element programatically

I have a services panel with add/remove button for each service. What I want to do is to put an HTML code into this box and it should render on the site just as it does when you set innerHTML of an element with javascript.

I scrolled through all the list of options and methods exposed for the box element in the site code editor, but couldn’t find anything.

I could’ve done by adding a custom script in the analytics section on the dashboard but I need the box to interact with the site code.

Is there no way to do it in code? If not, is there any round-about way of doing it?

You can’t embed HTML in a Wix Code page. You might want to consider using an HtmlComponent . For more information, see the article Working with the HTML Component in Wix Code .

HTML Component would be in an iFrame, I need to commincate with section through my page code.

@deepakm The articles and the API discuss how to communicate between the page and the HtmlComponent using messaging. The examples page has a few examples using HtmlComponents that illustrate how this is done.

@yisrael-wix I am getting CORS errors and a window.onMessage is not a function error?

Why is that? Both the origins are from the same domain and HTML Component doesn’t disapprove of the HTML either so it must be HTTPS safe as well. Then what is the issue? Please, help.

@yisrael-wix Ok, it’s working now. Thanks for the help.