我使用了两个具有相同类名的不同表,并将其放置在不同的 div 中,如下代码片段所示。
代码片段:
<div>
<div class="gridheader scrollcss">
<div>
<table class="table" style="position: relative;" cellspacing="0">
<colgroup>
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
</colgroup>
<thead>
<tr class="columnheader" style="cursor: pointer;">
<th class="headercell"><div class="headercelldiv">Taskname</div></th>
<th class="headercell"><div class="headercelldiv">Starttime</div></th>
<th class="headercell"><div class="headercelldiv">Endtime</div></th>
<th class="headercell"><div class="headercelldiv">Duration</div></th>
<th class="headercell"><div class="headercelldiv">Status</div></th>
</tr>
</thead>
<tbody class="hide">
<tr><td></td><td></td><td></td><td></td><td></td></tr>
</tbody>
</table>
</div>
</div>
<div class="gridcontent" style="height: 462px; overflow: auto;">
<div class="gridcontainer" style="height: 420000px;">
<table class="table" style="position: relative;" cellspacing="0">
<colgroup>
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
<col style="width: 160px;">
</colgroup>
<tbody>
<tr><td class="rowcell">1</td><td class="rowcell">01/01/2013</td><td class="rowcell">01/05/2013</td><td class="rowcell">0 days</td><td class="rowcell">2</td></tr>
</tbody>
</table>
</div>
</div>
</div>
如何使用jquery选择器选择gridcontainer div中的第二个表格位置并仅应用该表格的样式
最佳答案
$('.gridcontainer table').css(/*your styles*/);
关于javascript - 使用Jquery选择器选择div的子元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20158181/