JSFiddle - React, Tailwind, and code Playground
HTML
<form id="myForm">
<input type="text" id="theInput" value="/script.php">
<button type="button" id="changeForm">Update Action</button>
</form>
JavaScript
(function(){
document.getElementById('changeForm').onclick = function(e) {
document.getElementById('myForm').action = document.getElementById('theInput').value;
// reflecting change in console, inspect otherwise
console.log('Form submit: ' + document.getElementById('myForm').action);
}
})();