JSFiddle - React, Tailwind, and code Playground

HTML

<form id="theForm" action="foo.php">
...
    <input id="first" type="submit"/>
    <input id="second" type="submit"/>
</form>

JavaScript

$(document).ready(function() {
    $("#theForm input").click(function(e) {
        if(e.target.id == 'first') {
            $("#theForm").attr("action", "somePage.php");
        } else {
            $("#theForm").attr("action", "anotherPage.php");
        }
        alert($("#theForm").attr("action"));
        return false;
    });
});