Skip to content

Instantly share code, notes, and snippets.

@Lobstrosity
Created December 15, 2010 05:05
Show Gist options
  • Select an option

  • Save Lobstrosity/741652 to your computer and use it in GitHub Desktop.

Select an option

Save Lobstrosity/741652 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Templates</title>
</head>
<body>
<div class="items"><ul /></div>
<script class="items" type="text/x-jquery-tmpl">
<li>${$item.data}</li>
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script>
<script>
var items = [
'Item 1',
'Item 2',
'Item 3'
];
$('div.items ul').html($('script.items').tmpl(items));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment