JSFiddle - React, Tailwind, and code Playground

by blunderboy

HTML

<script src="https://raw.github.com/wycats/handlebars.js/1.0.rc.2/dist/handlebars.js"></script>
<script id="script" type="text/x-handlebars-template">
   <div class="entry">
    <h1> {{title}} </h1>
    <div class = "body">
       {{body}}
    </div>
</div>
</script>

JavaScript

console.log("Practicing Handlebars.js templating");

// Handlebar practice 
// Source: https://raw.github.com/wycats/handlebars.js/1.0.rc.2/dist/handlebars.js

var context = {
    title: "My first <p> tag",
    body: "<p> This is a post about &lt;/p&gt; tags </p>"
};

var source = $("#script").html();
var template = Handlebars.compile(source);

var html = template(context);

$("body").html(html);

// alert(html);