JSFiddle - React, Tailwind, and code Playground

HTML

<form action="/action_page.php">
  <label for="f1_input">First val:</label>
  <input type="text" id="f1_input" name="abc"><br><br>
 
  <label for="f2_input">second val:</label>
  <input type="text" id="f2_input" name="def"><br><br>
  
  <label for="output">output:</label>
  <input type="text" id="output" name="efg" ><br><br>
</form>

JavaScript

$(document).on('change','#f1_input, #f2_input',function(){
	$('#output').val($('#f1_input').val() + $('#f2_input').val());
});