JSFiddle - React, Tailwind, and code Playground

by Gabriel Rodrigues

HTML

<form id='form'>
<table class='table table-bordered'>
    <thead>
        <tr>
            <th>Código</th>
            <th>Produto</th>
            <th>Valor</th>
            <th>Quantidade</th>
            <th>Seleção</th>
        </tr>            
    </thead>
    <tbody>
        <tr>
            <td>001</td>
            <td><input type='text' name='produto' id='produto1' value='Produto 001'></td>
            <td><input type='text' name='valor' id='valor1' value="a"></td>
            <td><input type='number' name='quantidade' id='qtd1' value="10"></td>
            <td><input type='checkbox' name='selecao' id='selecao1' value='0' checked></td>
        </tr>
        <tr>
            <td>002</td>
            <td><input type='text' name='produto' id='produto2' value='Produto 002'></td>
            <td><input type='text' name='valor' id='valor2'></td>
            <td><input type='number' name='quantidade' id='qtd2'></td>
            <td><input type='checkbox' name='selecao' id='selecao2' value='1'></td>
        </tr>
    </tbody>
</table>

JavaScript

var tr = $('input:checkbox:checked').parent().parent();
console.log(tr.find(':input').serialize());