javascript - Accessing td's within a tr in CSS -
so have function needs handle <tr></tr>
, 3rd <td>
tag in it
how access 3rd <td>
tag inside this
trinput = following
<tr> <td>sup</td> <td>9</td> <td>5</td> </tr>
how access 3rd td
trinput.(whatgoes here access 3rd td)
if third mean last one, there lastelementchild
property fits need
const tr = document.getelementsbytagname('tr')[0] console.log(tr.lastelementchild) // content accessed with: console.log(tr.lastelementchild.innertext)
<table> <tr> <td>sup</td> <td>9</td> <td>5</td> </tr> </table>
Comments
Post a Comment