JSFiddle - React, Tailwind, and code Playground
HTML
<form id='foo' method="post">
<p>
<label>Message</label>
<textarea id='message' name='message' rows='5'></textarea>
</p>
<br/>
<p>
<label>Name</label>
<select id = "name" name='test'>
<option value = "1">one</option>
<option value = "2">two</option>
<option value = "3">three</option>
<option value = "4">four</option>
</select>
</p><br/>
<div id='success'></div>
</form>
<button type='submit' id='check'>Send</button>
<p id="showdata">
</p>
JavaScript
function showValues() {
var str = $( "form" ).serialize();
$( "#showdata" ).html( str );
}
$( "input[type='checkbox'], input[type='radio']" ).on( "click", showValues );
$( "select" ).on( "change", showValues );
showValues();