SHOW:
|
|
- or go back to the newest paste.
1 | <div class="game-container"></div> | |
2 | <script src="js/jquery-2.1.0.min.js"></script> | |
3 | <script src="js/underscore.js"></script> | |
4 | ||
5 | <script type="text/template" id="template"> | |
6 | - | <script type="text/template" class="template"> |
6 | + | |
7 | <%- rc.name %> | |
8 | </h2> | |
9 | </script> | |
10 | ||
11 | ||
12 | <script type="text/javascript"> | |
13 | // Grab the HTML out of our template tag and pre-compile it. | |
14 | var template = _.template( | |
15 | $( "#template" ).html() | |
16 | ); | |
17 | ||
18 | - | _.templateSettings.variable = "rc"; |
18 | + | |
19 | var templateData = { | |
20 | rc : { | |
21 | name: "Alex" | |
22 | - | $( "script.template" ).html() |
22 | + | } |
23 | }; | |
24 | ||
25 | // Render the underscore template and inject it after the H1 | |
26 | // in our current DOM. | |
27 | - | name: "Alex" |
27 | + | |
28 | template( templateData ) | |
29 | ); | |
30 | ||
31 | </script> |