0

why in a table cell insert a button element , number 1 become object "1" . when i try to insert a button to a table cell, i find the number will become object

<table>
    <thead>
      <td>num</td>
      <td>num</td>
      <td>num</td>
      <td>num</td>
    </thead>
    <tbody>
      <tr>
        <td class="one">
          1
          <input type="button">
        </td>
        <td>1</td>
        <td>1</td>
        <td>1</td>
      </tr>
    </tbody>
</table>

<script>
    var num = document.querySelector(".one")
    var num2 = num.childNodes[0]
    console.log(num2, typeof(num2))
</script>

result

Easton
  • 1
  • 1

0 Answers0