JSFiddle - React, Tailwind, and code Playground

HTML

<form id="theform">
    
    <input type="submit" name="s1" /> 
    <input type="submit" name="s2" />
    
    <input type="hidden" name="clicked" id="clicked" />
    
</form>    

<div id="result"></div>

JavaScript

var $form = $("#theform");
var $clicked = $("#clicked");

$form.find( "input[type='submit']").click( function(){
    $clicked.val( $(this).attr('name') );
});

$form.submit( function( e ){
    e.preventDefault();
    
    switch( $clicked.val() ){
     
        case 's1':
            alert( "Do thing 1" );
            return;
            
        case 's2':
            alert( "Do thing 2" );
            return;
    }
      
    
    $("#result").html( $clicked.val() );
    
});