Skip to content

Instantly share code, notes, and snippets.

@dmgarland
Created May 19, 2014 10:07
Show Gist options
  • Save dmgarland/50bf6db143ea24b8690b to your computer and use it in GitHub Desktop.
Save dmgarland/50bf6db143ea24b8690b to your computer and use it in GitHub Desktop.
Underscore template example (HTML)
<html>
<head>
<title>Underscore Howto</title>
<script type="text/javascript" src="javascripts/jquery-2.1.1.js"></script>
<script type="text/javascript" src="javascripts/underscore.js"></script>
<script type="text/javascript" src="javascripts/my_amazing_javascript.js"></script>
</head>
<body>
<h1>Underscore / JQuery practice</h1>
<div id="foo">
<div id="bar">
<div id="cool_beans">
</div>
</div>
</div>
<script type="text/template" id="animal_template">
<figure>
<h3><%= animal.name %></h3>
<dl>
<dt>Number of Legs</dt>
<dd><%= animal.number_of_legs %></dd>
</dl>
</figure>
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment