JSFiddle - React, Tailwind, and code Playground
HTML
<div>div 1 - with iframe
<iframe></iframe>
</div>
<div>div 2 without iframe</div>
<div>div 3 with iframe
<iframe></iframe>
</div>
<input type="button" id="remove" value="Remove" />
JavaScript
$('#remove').click(function () {
$("div:not(:has(iframe))").remove();
});