我有一个问题,我必须找到在桌子下面的跨文本,但我不能写这段代码:
var currentRow = $("#table").closest("tr.paging");
//do something with values in td's
var firstTDValue = currentRow.find("td").eq(0).children("span").text();
alert(firstTDValue);
<table>
<tr class="paging">
<td colspan="14">
<table>
<tbody>
<tr>
<td>
<span>1</span>
请任何人帮助我..
答案 0 :(得分:0)
试试这个
var a = $('.paging td span').text();
alert(a);
或
$('.paging td span').each(function(){
var a = $(this).text();
alert(a);
});
或在您的代码中(删除表中的#)
var currentRow = $("table").closest("tr.paging");
//do something with values in td's
var firstTDValue = currentRow.find("td").eq(0).children("span").text();
alert(firstTDValue);