JSFiddle - React, Tailwind, and code Playground
HTML
<form id="test" action="#">
<textarea name="textarea"></textarea>
<input name="input">
<button>submit</button>
</form>
<button form="test">submit</button>
JavaScript
$(document).on('submit', 'form', function (e) {
e.preventDefault();
}).on('click', ':submit', function (e) {
if (!$(document.activeElement).is(':submit')) return;
var form = $(this).closest('form').length ? $(this).closest('form')[0] : $('#' + $(this).attr('form'))[0];
form.submit();
});