JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head></head>
<body>
<form id="myForm">
<input type="text" name="text" id="text" />
<input type="button" id="button" name="button" value="Click me to get Html" />
</form>
</body>
</html>
JavaScript
$(document).ready(function () {
$('#button').click(function () {
var formData = $('#myForm').serializeArray();
var html = $('body').html();
$.each(formData, function () {
var name = this.name;
var value = this.value;
// TODO: set corresponding value to the name in the var html
});
});
});