JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" id="open" value="open">
<input type="button" id="close" value="close">
<iFrame class="frame" src="" title="https://www.fsonline.ro/" />

JavaScript

$('#open').on("click", function(){
    $('.frame').attr("src", $('.frame').attr("title"));
});

//Will have a function here to remove the attribute
$('#close').on("click", function(){
  $('.frame').attr("src", "");
});