Skip to content

Instantly share code, notes, and snippets.

@can3p
Created October 19, 2010 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save can3p/633867 to your computer and use it in GitHub Desktop.
Save can3p/633867 to your computer and use it in GitHub Desktop.
<script id="tpl" type="text/x-query-tmpl">
<ul>
{{tmpl ({ checkboxes: true, items: someitems }) "#genlist" }}
{{tmpl ({ checkboxes: false, items: otheritems }) "#genlist" }}
</ul>
</script>
<script id="genlist" type="text/x-query-tmpl">
{{each (idx, item) items}}
<li>{{if selectable }}<input type="checkbox" />{{/if}}${item.title}</li>
{{/each}}
</script>
<script>
var html = $("#tpl").tmpl({
someitems: ["item1", "item2"],
otheritems: ["item3", "item4"]
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment