Day 34 of #100daysojs

Table Navigation

Table Navigation

In this lesson, we will learn how to use table navigation to access the table element and its child nodes. We will also learn how to use table navigation to access the table rows and cells.

Certain DOM elements may provide additional properties specific to their type for convenience. The table element supports the following properties:

  • table.rows: Returns a live HTMLCollection of all the rows in the table.

  • table.caption: Returns the caption element of the table.

  • table.tHead: Returns the thead element of the table.

  • table.tFoot: Returns the tfoot element of the table.

  • table.tBodies: Returns a live HTMLCollection of all the tbody elements in the table.

Similarly, the tr element supports the following properties:

  • tr.cells: Returns a live HTMLCollection of all the cells in the row.

  • tr.sectionRowIndex: Returns the index of the row in the current section (thead, tbody, or tfoot).

  • tr.rowIndex: Returns the index of the row in the table.

the td element also support the some properties inlcluding: