TableHeader rowSpan Property - Return the number of rows a specific table cell should span: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:TableHeader

Description

TableHeader rowSpan Property - Return the number of rows a specific table cell should span:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
}
</style>//from   w  w w. ja va  2 s  .  c o m
</head>
<body>

<table>
  <tr>
    <th id="myTh" rowspan="2">Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$100</td>
  </tr>
</table>
<br>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    var v = document.getElementById("myTh").rowSpan;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials