JSFiddle - React, Tailwind, and code Playground
HTML
<form id="3" method='post'>
<input type="text" name="x" value="2" />
<input type="text" name="y" value="3" />
<input type="submit" />
</form>
<form id="4" method='post'>
<input type="text" name="a" value="1" />
<input type="text" name="b" value="4" />
<input type="submit" />
</form>
JavaScript
function submitForm(form){
$(':input', form).each(function(){
alert($(this).val());
});
}
$(document).ready( function (){
$('form').submit( function(){
submitForm(this);
return false;
});
});