JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<body>
<button>add</button>
<iframe src="http://www.w3schools.com"></iframe>
</body>
</html>
JavaScript
$(document).ready(function() {
$('button').on('click', function() {
$('<iframe src="http://www.w3schools.com"></iframe>').on('load',function() {
console.log(this)
alert('loaded')}).insertAfter('button');
});
$(window).on('load', function() {
console.log('loaded'); // doesn't fire when dynamically added iframes load
});
});