JSFiddle - React, Tailwind, and code Playground

HTML

<div id='parent' style='border: 1x solid orange;'></div>

JavaScript

var button = $("<input type='button' value='click me' />");
button.click(function() {
    alert("hello");
});

$('<iframe id="someId"/>')
	.appendTo('#parent')
	.contents().find('body')
	.append(button);