JSFiddle - React, Tailwind, and code Playground

by Daedalus

HTML

<form method="post" action="" class="vForm">
    <table>
        <tr>
            <td><input type="text" name="qty" value="1" size="3" /></td>
        </tr>
        <tr>
            <td><input type="submit" name="add" value="add" class="button" /></td>
        </tr>
    </table>
</form>

JavaScript

$(function () {
    function add(form) {
        console.log('Form: ' + form.find('[name="qty"]').val());
        return false;
    }

    $('.vForm').submit(function (e) {
        add($(this));
        e.preventDefault();
    });
});