How to create clickable button table cell show hide cells

Learn How to create clickable button table cells"show" or "hide" empty order with HTML JAVASCRIPT  code ar3school

Example:

<head>
<style> 
table, td {
  border: 1px solid black;
  margin: 15px;
}
</style>
</head>
<body>

<p>Click the button to "hide" or "show" empty table-cells:</p>

<button type="button" onclick="hide()">Hide empty cells</button>
<button type="button" onclick="show()">Show empty cells</button>

<table id="myTable">
  <tr>
    <td>Peter</td>
    <td>Griffin</td>
  </tr>
  <tr>
    <td>Lois</td>
    <td></td>
  </tr>
</table>

<p><b>Note:</b> Internet Explorer 8 supports the empty-cells property only if a !DOCTYPE is specified.</p>

<script>
function hide() {
  document.getElementById("myTable").style.emptyCells = "hide";
}

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

</body>



Try this code from here



Comments :

Post a Comment