jquery-tmpl
table
by ysuper
HTML
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
</head>
<body>
<div id="movieList"></div>
<script id="test1" type="text/x-jquery-tmpl">
<table style="border-collapse: collapse; width: 50%;" border="1">
<tbody>
<tr>
<td style="width: 50%;">${Name}</td>
<td style="width: 50%;">${ReleaseYear}</td>
</tr>
</tbody>
</table>
</script>
</body>
</html>
JavaScript
var movies = [{
Name: "The Red Violin",
ReleaseYear: "1998"
},
{
Name: "Eyes Wide Shut",
ReleaseYear: "1999"
},
{
Name: "The Inheritance",
ReleaseYear: "1976"
}
];
$("#test1").tmpl(movies)
.appendTo("#movieList");