JSFiddle - React, Tailwind, and code Playground

HTML

<form id="frm1">
    First name: <input type="text" name="fname" value="" /><br />
    Last name: <input type="text" name="lname" value="" /><br />
    <input type="button" id="btn" value="Submit" />
</form>
<div id="result">
    text will appear here
</div>

JavaScript

$('input#btn').click(function(){
    var $inputs = $('form#frm1 :input[type="text"]'),
        result = "";
    $inputs.each(function(){
        result += $(this).val()+"<br>";
    });
    $('div#result').html(result);
});