我有一個表,其中包含rowspan和rows不包含rowspan的列。我想從下表中讀取日期列。通讀表並顯示日期
我想閱讀2010年1月1日,星期二2010年1月2日,星期二2010年1月3日...等等... 我該怎麼做?
請注意,有一些rowspan和其他列沒有。
我有一個表,其中包含rowspan和rows不包含rowspan的列。我想從下表中讀取日期列。通讀表並顯示日期
我想閱讀2010年1月1日,星期二2010年1月2日,星期二2010年1月3日...等等... 我該怎麼做?
請注意,有一些rowspan和其他列沒有。
試試這個 -
var maxcols = 0;
$('table tr').each(function() {
$(this).children().length > maxcols ? maxcols = $(this).children().length : maxcols = maxcols;
});
$('table tr td:first-child').each(function() {
if ($(this).text() != '' && $(this).parent().children().length === maxcols)
alert($(this).text());
});
@learning - 出於興趣,你爲什麼不接受這個答案 - 你是否發現代碼有問題? – ipr101