JSFiddle - React, Tailwind, and code Playground
HTML
<form id="myForm" method="post">
<input name="html" type="text" value="a query"size="60">
<input type="button" id="button1" value="first" />
<input type="button" id="button2" value="lefty" />
<input type="button" id="button3" value="righty 2" />
</form>
<p>Lefty</p>
<iframe name="lefty"></iframe>
<p>Righty</p>
<iframe name="righty"></iframe>
JavaScript
$(document).ready(function(){
$("#button1").click(function(){
$('form#myForm').attr({action: "/echo/html/"});
$('form#myForm').attr({target: "righty"});
$('form#myForm').submit();
});
$("#button2").click(function(){
$('form#myForm').attr({action: "/echo/html/"});
$('form#myForm').attr({target: "lefty"});
$('form#myForm').submit();
});
$("#button3").click(function(){
$('form#myForm').attr({action: "/echo/html/"});
$('form#myForm').attr({target: "righty"});
$('form#myForm').submit();
});
});