Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
table {
  width: 100%;
}
table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>
<p>Click the button to return the value of the headers attribute of td with id "myTd".</p>
<table>
  <tr>
    <th id="name">Name</th>
    <th id="email">Email</th>
    <th id="phone">Phone</th>
    <th id="addr">Address</th>
  </tr>
  <tr>
    <td id="myTd" headers="name">John Doe</td>
    <td headers="email">someone@example.com</td>
    <td headers="phone">+45342323</td>
    <td headers="addr">Rosevn 56,4300 Sandnes,Norway</td>
  </tr>
</table>
<br>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myTd").headers;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>