1<script id="hidden-template" type="text/x-custom-template">
2 <tr>
3 <td>Foo</td>
4 <td>Bar</td>
5 <tr>
6</script>
7
8then in javascript:
9
10var template = $('#hidden-template').html();
11// the following line is to set some value in the template
12// if the template code is static you can skip the following line
13template.find('#en-element-to-set-its-value').html("<p>This is the new value</p>");
14$('button.addRow').click(function() {
15 $('#targetTable').append(template);
16});
17
18