JSFiddle - React, Tailwind, and code Playground

by whizzzkid

HTML

<form action="" method="post" id="myform">
	<input type="text" name="val1">
	<input type="text" name="val2">
	<input type="button" onClick="submitTo('myform','');" value="Submit One" />
	<input type="button" onClick="submitTo('myform','some-script.php');" value="Submit Two" />
</form>

JavaScript

function submitTo(what,to){
	var frm=document.getElementById(what);
	frm.action = to;
	frm.submit();
}