簡體   English   中英

如何從表格中選擇所有列標題

[英]How do I select all the column headers from a table

這是我的小提琴

這是我的位置:

$('#mytable thead tr').each(function(index) {
        //console.log($(this).html())    
    console.log(index)
});

$(this).html()獲取所有列標題。

這是小提琴

$('#mytable thead tr th').each(function(index) {
        console.log($(this).html())    
    console.log(index)
});

Headers存儲在th ,因此您需要更深一層。

$('#mytable thead tr th').each(function(index) {
    console.log($(this).html())    
});

小提琴

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM