Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created June 20, 2011 21:45
Show Gist options
  • Save jimmycuadra/1036659 to your computer and use it in GitHub Desktop.
Save jimmycuadra/1036659 to your computer and use it in GitHub Desktop.
jQuery Template example
<!DOCTYPE html>
<html>
<head>
<title>jQuery Template Example</title>
</head>
<body>
<ul id="engineers"></ul>
<script id="tmpl-engineer" type="text/x-jquery-tmpl">
<li>${name}</li>
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var oEngineers = [
{ name: "Jimmy" },
{ name: "Ray" },
{ name: "Richard" },
{ name: "Michael" },
{ name: "Vincent" },
{ name: "Nick" }
];
$('#tmpl-engineer').tmpl(oEngineers).appendTo('#engineers');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment