Reference: link
Example usage:
Javascript:
window.onload = function() {
var contentHTML = document.getElementById("teste").content;
var linha = document.importNode(contentHTML, true);
document.getElementById("tabela").appendChild(linha);
}();
HTML:
<table id="tabela" class="table" style="width: 820px;">
<!-- aqui entra a templae -->
</table>
<!-- template -->
<template id="teste">
<caption>Optional table caption.</caption> <thead> <tr> <th>#</th> <th>First Name</th> <th>Last Name</th> <th>Username</th> </tr> </thead> <tbody> <tr> <th scope="row">1</th> <td>Mark</td> <td>Otto</td> <td>@mdo</td> </tr> <tr> <th scope="row">2</th> <td>Jacob</td> <td>Thornton</td> <td>@fat</td> </tr> <tr> <th scope="row">3</th> <td>Larrya</td> <td>the Bird</td> <td>@twitter</td> </tr> </tbody>
</template>