Testing Mustache.js Template

by navindian

HTML

<script src="https://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<div id="aosdiv"></div>

CSS

div {
    font:14px Arial;
    margin:50px 20px;
}

JavaScript

$(function () {

    var template ='<h1>{{header}}</h1>
    <div>Shop iMac </div>
    <div>Shop iPhone</div>
    <div>Shop iPad</div>
    <div>Shop iPod</div>
    ';

    var json = {
            "header": "Apple Store",
            "bolder": function () {
            return function (text, render) {
                return render(text)
            }
        }
    };

    var html = Mustache.to_html(template, json);
    $('div#aosdiv').html(html);



});