gpt4 book ai didi

javascript - 使用jquery在td中查找div

转载 作者:行者123 更新时间:2023-12-02 17:19:12 26 4
gpt4 key购买 nike

我正在尝试从第 15 td 列获取 div 并将 div 的宽度设置为 300px。

我有表格摘要来识别该表格。如何设置宽度?

<table  summary="Copy and Design RFP">
....
...
/* column15*/
<td class="ms-vb2">
<div dir="">1/9/14 - 1st draft sent</div>
</td>

到目前为止我已经写了

 $(document).ready(function () {
if (window.location.href.indexOf("dept/mkt/Lists/Request for Projects/Active Projects.aspx") > -1) {
$('table[summary="Copy and Design RFP"] tr td:nth-child(15)').each(function() {
var id = $(this).find('div'); // This is not working
});
}
});

最佳答案

使用nth-child选择器:

$('table[summary="Copy and Design RFP"] td:nth-child(15) div').css('width', '300px');

关于javascript - 使用jquery在td中查找div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24127472/

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