Sha256: 8c1e41766cbdb5d99c2bbeb50932b144f35a4a3af4f131a0e83cf61819ac9240

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 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="01_render-template.html">Prev</a> <a href="index.html">Home</a> <a href="03_compiled-template.html">Next</a><br />

<h3>2 Render template from string</h3>

<!--====== Container ======-->
<table><tbody id="details"></tbody></table>

<!--====== Script ======-->
<script type="text/javascript">

var person = {
	firstName: "Jeff"
};

// Render to string
var html = $.templates( "<tr><td>{{:firstName}}</td></tr>" ).render( person );

// Insert as HTML
$( "#details" ).html( html );

</script>

<!--================ End of Demo Section ================-->

<h4>Data:</h4>
<pre class="brush: js;">
var person = {
    firstName: "Jeff"
};
</pre>

<h4>Script:</h4>
<pre class="brush: js;">
// Render to string
var html = $.templates( "&lt;tr>&lt;td>{{:firstName}}&lt;/td>&lt;/tr>" ).render( person );

// Insert as HTML
$( "#details" ).html( html );
</pre>
</body>
</html>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kit_cms-2.3.22 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.20 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.19 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.18 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.17 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.16 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.15 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.14 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.13 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.11 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.10 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.9 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.8 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.7 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html
kit_cms-2.3.6 app/assets/javascripts/views/demos/jQueryConfDemosOct2011/02_template-from-string.html