gpt4 book ai didi

javascript - 在控制台中获取表 td 的内容

转载 作者:行者123 更新时间:2023-11-28 19:41:05 25 4
gpt4 key购买 nike

事实证明,这非常棘手。附件是我想要从 DOM 获得的内容的屏幕:

enter image description here

我想要带有产品价格类的 td 的innerHTML(或者至少我认为我这样做了)。

这是我尝试过的所有内容和输出的另一个屏幕: enter image description here

如何让主机返还 59.99 美元?重要的是它来自第一个元素,而不是第二个元素,其中 59.99 也存在

在评论之后,这里是更广泛的 html:

<table cellspacing="1" class="store_location_list">


<tr>
<th class="item-type">Item<br />Type</th>
<th class="item-desc">Item<br />Description</th>
<th class="total-qty">Total<br />Quantity</th>
<th class="product-price">Product<br/>Price</th>
<th class="total-price">Total<br/>Price</th>
<th class="removeItemLink"> </th>
</tr>

<tr>
<td class="item-type">Metal Wall Art</td>
<td class="product-description-long">Metal Wall Art</td>
<td class="total-qty">1</td>

<!-- ************************************** -->
<td class="product-price">$59.99</td>
<td class="total-price">$59.99</td>
<td class="removeItemLink"><a href="#" onclick="__doPostBack('order_summary_remove_product', 'RetailerProductID_137'); return false;">Remove</a></td>
</tr>


</table>

最佳答案

document.querySelector('td.product-price').innerHTML

关于javascript - 在控制台中获取表 td 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25022497/

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