Sha256: 2f62ff34e2b2b6b2964be2719ecaa4c26f3c9220cfccae6d8f2bb5dcd3264b16
Contents?: true
Size: 1.59 KB
Versions: 15
Compression:
Stored size: 1.59 KB
Contents
<!DOCTYPE html> <html> <head> <link href="resources/presentation.css" rel="stylesheet" type="text/css" /> <link href="resources/syntaxhighlighter.css" rel="stylesheet" type="text/css" /> <script src="resources/syntaxhighlighter.min.js" type="text/javascript"></script> <script src="http://code.jquery.com/jquery.js" type="text/javascript"></script> <script src="../../jsrender.js" type="text/javascript"></script> </head> <body> <a href="index.html">Home</a> <a href="02_template-from-string.html">Next</a><br /> <h3>1 Render template from script block</h3> <!--====== Container ======--> <table><tbody id="details"></tbody></table> <!--====== Template ======--> <script id="personTmpl" type="text/x-jsrender"> <tr> <td>{{:firstName}}</td> </tr> </script> <!--====== Script ======--> <script type="text/javascript"> var person = { firstName: "Jeff" }; // Render to string var html = $( "#personTmpl" ).render( person ); // Insert as HTML $( "#details" ).html( html ); </script> <!--================ End of Demo Section ================--> <h4>HTML:</h4> <pre class="brush: xml;"> <!--====== Template ======--> <script id="personTmpl" type="text/x-jsrender"> <tr> <td>{{:firstName}}</td> </tr> </script> <!--====== Container ======--> <table><tbody id="details"></tbody></table></pre> <h4>Data:</h4> <pre class="brush: js;"> var person = { firstName: "Jeff" }; </pre> <h4>Script:</h4> <pre class="brush: js;"> // Render to string var html = $( "#personTmpl" ).render( person ); // Insert as HTML $( "#details" ).html( html ); </pre> </body> </html>
Version data entries
15 entries across 15 versions & 1 rubygems