It might be a little help figuring out why my Mustache template is not displaying properly. I am very confused why the following does not work. I'm sure this is my stupid mistake or something.
var tableRows = [ {name: 'name1', values: ['1','2','3']}, {name: 'name2', values: ['1','2','3']}, {name: 'name3', values: ['1','2','3']} ]; var template = $('#mustache-template').html(); $('#target').append(Mustache.render(template, {rows: tableRows}));
HTML template:
<div id="mustache-template"> <table> <tbody> {{#rows}} <tr class=""> <td>{{name}}</td> {{#values}} <td>{{.}}</td> {{/values}} </tr> {{/rows}} </tbody> </table> </div>
I expect the table with each element of the array to be its own row, but instead I get the following:
[object Object]
Here's jsFiddle to illustrate: http://jsfiddle.net/gF9ud/
Muers source share