TAG
CSS
JavaScript
Result
Run
License
<table id="mytable" class="simplely"> <caption>National Capital</caption> <tbody> <tr> <td>Korea</td> <td>Seoul</td> </tr> </tbody> </table> <p><button type="button" id="btn-del">Delete to caption</button></p>
.simplely { border-collapse: collapse; } .simplely caption { padding: 5px; } .simplely th, .simplely td { border: 1px solid gray; padding: 5px 10px; }
window.addEventListener("load", () => { const $elTable = document.querySelector("#mytable"); const $elBtnDel = document.querySelector("#btn-del"); $elBtnDel.addEventListener("click", () => { $elTable.deleteCaption(); }); });
Console
expand_less
License
License
by DevDic
Close