<div id="output"></div>
<script id="template" type="text/x-jsrender">
<ul>
{{for}}
<li>{{:name}} likes to wear {{:shirtColor}} shirts</li>
{{/for}}
</ul>
</script>
var data = [{
name: 'Dan Wahlin',
shirtColor: 'white'},
{
name: 'John Papa',
shirtColor: 'black'},
{
name: 'Scott Guthrie',
shirtColor: 'red'}
]
;
$('#output').html($('#template').render(data));
var data = { people: [{
name: 'Dan Wahlin',
shirtColor: 'white'},
{
name: 'John Papa',
shirtColor: 'black'},
{
name: 'Scott Guthrie',
shirtColor: 'red'}
]
}
;
<ul id="output"></ul>
<script id="template" type="text/x-jsrender">
<li>{{:name}} likes to wear {{:shirtColor}} shirts</li>
</script>
<script id="template" type="text/x-jsrender">
<ul>
{{for #data}}
<li>{{>name}} likes to wear {{>shirtColor}} shirts</li>
{{/for}}
</ul>
</script>