【发布时间】:2021-08-11 21:44:30
【问题描述】:
如何避免 jquery 表示例输出中的重复字符串是 here 我希望将问题合并到一个列中。预期的表(输出)看起来像this
var list=[
{q:'Question1',r:'response1',credit:4},
{q:'Question2',r:'response2',credit:9},
{q:'Question2',r:'response3',credit:3},
{q:'Question3',r:'response4',credit:8},
{q:'Question3',r:'response5',credit:9},
{q:'Question3',r:'response6',credit:3},
{q:'Question4',r:'response7',credit:7},
{q:'Question4',r:'response8',credit:9},
{q:'Question4',r:'response9',credit:3},
{q:'Question4',r:'response10',credit:1},
{q:'Question5',r:'response11',credit:5},
{q:'Question5',r:'response12',credit:3}
];
$.each(result, function (key,qstn) {
html += '<tr>';
html += '<td>' + qstn.q+ '</td>';
html += '<td>' + qstn.response+ '</td>';
html += '</tr>';
});
});
$('.tbody').append(html);
【问题讨论】:
-
您能否添加有关您用于创建表的数据的更多详细信息?
标签: html jquery html-table