Home
Run

Demo: Render template against local data

Data:

var movies = [
	{ Name: "The Red Violin", ReleaseYear: "1998" },
	{ Name: "Eyes Wide Shut", ReleaseYear: "1999" },
	{ Name: "The Inheritance", ReleaseYear: "1976" }
];

HTML:

<script id="movieTemplate" type="text/x-jquery-tmpl">
	<li>
		<b>${Name}</b> (${ReleaseYear})
	</li>
</script>

<ul id="movieList"></ul>

Script:

$( "#movieTemplate" ).tmpl( movies )
	.appendTo( "#movieList" );