Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Replace manual HTML generation by the use of Handlebars

html  = '<ul>';
for (i = 0; i < data["items"].length; i++) {
    html += '<li>';
    html += data["items"][i]["text"];
    html += '<button class="delete" data-id="' +  data["items"][i]["_id"]["$oid"]  + '">x</a>';
    html += '</li>';
}
html += '</ul>';
<script id="show-items-template" type="text/x-handlebars-template">
<ul>
{{#each data.items}}
    <li>{{ text }} <button class="delete" data-id="{{ _id.$oid }}">x</a></li>
{{/each}}
</ul>
</script>