只是想知道是否有人可以帮助我。需要帮助使用'for循环'从表中提取数据
我创建了一个表格,并使用Javascript我将所有数据提取并放入div。
$(function() {
$('table').each(function() {
var output = "",
table = $(this),
rowHead = table.find('tbody tr th'),
rowSubject = table.find('thead tr th:not(:first-child)'),
rowContent = table.find('tbody tr td'),
copy = table.clone();
output += '<div class="mobiled-table">';
for (i = 0; i < rowHead.length; i++) {
output += '<div class="head">' + $(rowHead[i]).html() + '</div>';
for (j = 0; j < rowSubject.length; j++) {
output += '<div class="subject">' + $(rowSubject[j]).html() + '</div>';
output += '<div class="content">' + $(rowContent[i]).html() + '</div>';
}
}
output += '</div>';
$('table').append(output);
});
});
这一切都很好,除了.content类不能正常工作。我相信我正在使用错误的'for循环',或者我需要创建另一个'for循环'。请看看我的codepen,你会看到我的问题
http://codepen.io/anon/pen/JrKBf
我希望有人可以提供帮助。
您还没有在css中创建**'.content' **类。 ?? – prog1011 2014-10-07 12:47:28