We define the button_click() function to send the text in the HTML element's text input to the data sent to the page code. Next, when the button in the HTML element is clicked, it calls the button_click() function. This event handler is called each time the HTML element receives a message from the page code. There are two parts to the messaging logic.įirst, when the HTML element loads, we set its onMessage property to an event handler that sets the text of the element's to be the data sent from the page code. In the tag, we define our messaging logic. The iframe tag in HTML stands for Inline Frame and is used to embed another HTML document within the current document. We are just using them to mimic the design of the Wix page elements. In the tag, we define some styles that are used by the HTML elements mentioned above. An that is used for entering the message to send to the page code.A that is used for sending messages to the page code.A that is used to display messages received from the page code.Similar to what we created using Wix page elements, we have: In the tag, we define the HTML elements that make up our page. The following code is added to the HTML element using the Edit Code button. I have a string of HTML tags that I can add to or change whenever I like. But if the widget or library just needs to send data to or receive data from your page elements, you can write code to make it work. This means that widgets or libraries that need access to the rest of your page will not work in an HTML element. You can, however, pass data between your page code and the code in an HTML element.
The HTML element creates a sandboxed environment (an iframe) that does not have direct access to the other elements on your page. The HTML Inline Frame element (