JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="frameId">
<ul>
<li id="item1">Coffee</li>
<li id="item2">Tea</li>
</ul>
</div>
<p>Click the button get the HTML content of the iframe.</p>
<textarea id="demo"></textarea><br/>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var frameContent = document.getElementById("frameId").innerHTML;
document.getElementById("demo").innerHTML = frameContent;
}
</script>
</body>