0
我正在使用mustachesjs将HTML代码添加到我的页面。我试图用mustachejs在表中添加一行,但td元素或tr元素不在html代码中。用jquery获取表格行的html代码
这里是mustachejs模板:
和JavaScript代码:
$.get("mustache", function(template) {
var output = Mustache.render($(template).filter('#tpl-general-tr-phone').html(),
{
number : phonenumber,
type : phonetype,
published : 1
});
console.log(output);
$('.table-phones').append(output);
});
任何人都知道解决这个问题呢?
谢谢您的帮助
为什么是一个div里面的TR元素而不是一张桌子? – nnnnnn
@nnnnnn该div用于定义要获取的胡须模板。我在同一个文件中有多个模板,div用于获取我想要使用的模板。在这里,该模板用于向表中添加一行 – bidou88