Get Table Children

For a question on Stackoverflow.

by Vinit Divekar

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id='table-draggable1' class="table">
  <tbody id="myTbody" class="connectedSortable">
    <tr>
      <input type="hidden" value="1" />
      <td>Test1</td>
      <td><input class="btn btn-danger" value=" Remove " onclick="removeFromAllocation(this)" /></td>
    </tr>
    <tr>
      <input type="hidden" value="1" />
      <td>Test2</td>
      <td><input class="btn btn-danger" value=" Remove " onclick="removeFromAllocation(this)" /></td>
    </tr>
    <tr>
      <input type="hidden" value="1" />
      <td>Test3</td>
      <td><input class="btn btn-danger" value=" Remove " onclick="removeFromAllocation(this)" /></td>
    </tr>
  </tbody>
</table>

JavaScript

$('#myTbody > tr').each(function() {
  console.log($(this).children().first().val());
  console.log($(this).children('td').eq(0).html());

});