gpt4 book ai didi

jquery - 使用 jquery 但来自表内表的 td 值

转载 作者:行者123 更新时间:2023-12-01 03:50:56 25 4
gpt4 key购买 nike

我想获取 t2 类表中 td 内元素的 td 值我怎样才能实现它?我尝试过,但没有帮助

var test = $(.lv1 tr:nth-child(" + row2 + ")").children("td:last").children(".lv2 tr:last").children("td:last").html();

表格

<listview1>
<itemtemplate>
<table class="t1">
<tr class="lv1"><td></td><td></td></tr>
<tr class="lv1"><td colspan="2">
<listview2>
<itemtemplate>
<table class="t2">
<tr class="lv2">
<td></td>
</tr>
<tr class="lv2">
<td></td>
</tr>
</table>
</itemtemplate>
</listview2>
</td></tr>
</table>
</itemtemplate>
</listview1>

最佳答案

好的,根据您的反馈,我认为这就是您所追求的。单击“执行”按钮即可查看其实际效果。

http://jsfiddle.net/mSHKC/

$('#go').click( function() {
var id = 'foo'; //hardcode id retrieval on button press
//value of first td of first row in table.t2
var firstTdFirstRow = $(this).closest('table.t1').find('table.t2 tr:first td:first').html();
//value of first td of last row in table.t2
var firstTdLastRow = $(this).closest('table.t1').find('table.t2 tr:last td:first').html();
});

您有此评论,但我不确定它的含义,因为我认为您犯了拼写错误。

 its selecting right td which i want to but while appenind its getting error

关于jquery - 使用 jquery 但来自表内表的 td 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8707142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com