How do I include an HTML element to Database / Dynamic page?

Thanks Giri!
Spend all day trying to make it work. What I have thus far is this:

(excuse the terminology😅)

- **My full script in the properties, field key: Slider:** 

- Inside the HTML component (#beforeafter) the on/postMessage code from your article:

<!doctype html>
<html>
<head>
<script type="text/javascript">
window.onmessage = (event) => {
if (event.data) {
document.getElementById("Slider").innerHTML = event.data;
}
};
function sendLoadMessage () {
window.parent.postMessage("LoadOk", "*");
}
</script>
</head>
<body onload="sendLoadMessage ();" style="background-color:lightgrey;">
<div id="Slider"></div>
</body>
</html>
- In the main program, this:
(not sure if i'm supposed to use those first two lines)
$w("#beforeafter").postMessage(txtMessage);
$w("#beforeafter").show();


let urlMessage = $w('#dataset1').getCurrentItem().Slider;
$w("#beforeafter").onMessage( (event) => {
$w("#beforeafter").postMessage(urlMessage);
});
(but with this error)

When I preview, besides the “txtMessage error” I also get a script error.

So I applied the tips you gave me to my best “understanding”, and also read other articles/posts, but I’m not getting any further at this point.

Any thoughts to make it work?
Thanks