试试 Jquery Templates,它为你提供了更多的灵活性Jquery Template
来自 Jquery 示例。
<script id="movieTemplate" type="text/x-jquery-tmpl"> //this is template
<li><b>${Name}</b> (${ReleaseYear})</li>
</script>
<ul id="movieList"></ul>
<script>
var movies = [ // data for the template
{ Name: "The Red Violin", ReleaseYear: "1998" },
{ Name: "Eyes Wide Shut", ReleaseYear: "1999" },
{ Name: "The Inheritance", ReleaseYear: "1976" }
];
/* Render the template with the movies data and insert
the rendered HTML under the "movieList" element */
$( "#movieTemplate" ).tmpl( movies )
.appendTo( "#movieList" );
</script>
如果你想要更多的功能,你可以试试 HandleBar.JS HandleBar JS
- 基本 HandleBarjs 表达式