I would only want to render/create <p>Hello</p><iframe id="syndicationPanelModalIFrame" src="http://sample.com" width="100%" height="100%" style="border: none"> on page load.
I don't want to declare them already but I want to trigger JS and create them once page loads.
Pls see "Expected Output" below
EXPECTED OUTPUT
<style>
.newSyndicationModalContainer {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
.newSyndicationModalContent {
background-color: transparent;
margin: auto;
width: 100%;
height: 100%;
}
</style>
<div class="newSyndicationModalContainer">
<div class="newSyndicationModalContent">
<p>Hello</p><iframe id="syndicationPanelModalIFrame" src="http://sample.com" width="100%" height="100%" style="border: none"></iframe>
</div>
</div>
Current Code
<script>
const newSyndicationModalContainer = document.querySelector(".newSyndicationModalContainer")
const newSyndicationModalContent = document.querySelector(".newSyndicationModalContent")
if (newSyndicationModalContainer) {
var modal = document.createElement(`<p>Hello</p><iframe id="syndicationPanelModalIFrame" src="http://sample.com" width="100%" height="100%" style="border: none"></iframe>`);
newSyndicationModalContainer.appendChild(modal);
newSyndicationModalContainer.style.display = 'block';
}
</script>