var thCollection=$(#tablename).find('th');
$.each(thCollection,function(i,obj){
// here I want the text of the column header
// obj.text or obj.html is not working
});
答案 0 :(得分:1)
试试这个: -
var thCollection=$('#tablename').find('th');
$.each(thCollection, function (i, obj) {
//try to convert obj to jquery object
var text = $(obj).text();
});
或者您也可以使用此
thCollection.each(function () {
var text = $(this).text();
})