jquery问题:获取table里第5个td的text()

有4个table,循环出来的,class一样,现在想获取table里第5行tr里td的内容,如果为空,则删除当行tr。

第1个回答  推荐于2016-04-24
$("table").find("tr:eq(4)").each(function () {
if($.trim($(this).text())==""){
$(this).remove();

}

});本回答被提问者采纳
第2个回答  2015-04-28
$(".classname").find("tr:eq(4)").each(function (i){
        var text = $(this).find("td").html();
        if($.trim(text)==""){
            $(this).remove();
        }   
});

追问

谢谢!

相似回答