JSFiddle - React, Tailwind, and code Playground

from https://stackoverflow.com/questions/22187166/taking-text-from-a-modal-input-field-and-placing-in-into-a-table

by dledle2

HTML

<body>
    <div>
        <input type="text" class="form-control" id="addHousemate" placeholder="Housemate's Name">
            <button id="mybutton" class="btn btn-primary" name="addHousemate">Submit</button>
    <//div>
    <table id="housemateTable">
        <tr><td>First Column</td></tr>
    </table>    
</body>

JavaScript

$('button[name="addHousemate"]').click(function() {
    var value = $('input[id="addHousemate"]').val();
    $('tr td:last').after("<tr><td>" + value + "</td></tr>");
    $('input[id="addHousemate"]').val('');
});