JSFiddle - React, Tailwind, and code Playground
by Hifni Nazeer
HTML
<table id="TableView">
<tbody>
<tr>
<th>Module</th>
<th>Message</th>
</tr>
<tr class="item">
<td> car</td>
<td>
<input class="name" type="text">
</td>
<td>
<input class="id" type="hidden" value="5">
</td>
</tr>
<tr class="item">
<td> bus</td>
<td>
<input class="name" type="text">
</td>
<td>
<input class="id" type="hidden" value="9">
</td>
</tr>
</tbody>
</table>
<button>
click
</button>
JavaScript
$(document).ready(function() {
$('button').click(function() {
$("table > tbody > tr").each(function(idx, tr) {
var val1 = $(this).find("input.name").val();
var val2 = $(this).find("input.id").val();
var val3 = $(this)[idx];
console.log(val1);
console.log(val2);
console.log(val3);
});
});
});