JSFiddle - React, Tailwind, and code Playground
HTML
<form id="form-id">
<input type="text" id="name" name="name" value="My Name" />
<input type="text" id="email" name="email" value="My Email" />
<input type="text" id="country" name="country" value="My Country" />
<input type="text" id="department" name="department" value="My Department" />
<input type="submit">
</form>
<br />
<br />
<div id="output">Serialized Output:</div>
CSS
#output {
position : absolute;
left : 20px;
right : 20px;
bottom : 20px;
word-wrap : break-word;
border : 1px solid #000;
min-height : 20px;
}
JavaScript
function formCheck(formEle) {
//do your validation
return false;
}
$(function () {
$('#form-id').on('submit', function () {
$('#output').html('Serialized Output:<br />\n<br />\n' + $(this).serialize());
return formCheck(this);
});
});