开发者

Pull text <TD:last> based on content of the first <TD:first>

开发者 https://www.devze.com 2022-12-17 04:30 出处:网络
I have a table with a dozen rows, one of which is:开发者_如何学运维 <TR><TD> <B>Order Date</B> </TD><TD> [foo] </TD></TR>

I have a table with a dozen rows, one of which is:开发者_如何学运维

<TR><TD>
<B>Order Date</B> </TD><TD> [foo] </TD></TR>

<TR><TD>

and i want to assign the value of the last cell to a var.

thx


try:

var text = $('td:contains("Order Date")').parent().children('td:last').text();


Your question is somewhat unclear.

You can get the last child of a row for which the first child contains Order Date like this:

$('tr:has(td:first-child:contains("Order Date")) td:last-child').text()


cleaner:

  var cellText = $('td:contains("Order Date")').nextAll(':last').text();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号