Set the emptyCells property to show from hide - Javascript CSS Style Property

Javascript examples for CSS Style Property:emptyCells

Description

Set the emptyCells property to show from hide

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
table, td {
    border: 1px solid black;
    border-collapse: separate;
}
</style>//from w  w w.  j a  v  a  2s  . c  om
</head>
<body>

<table id="myTable" style="empty-cells:hide;">
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td></td>
  </tr>
</table>
<br>

<button type="button" onclick="myFunction()">Return the emptyCells property</button>

<script>
function myFunction() {
    document.getElementById("myTable").style.emptyCells = 'show';
}
</script>

</body>
</html>

Related Tutorials