-1
*[@id="something"]/table/thead/tr/th[2]
のテーブル内のエレメント<th>A</th>
を選択して幅を変更する必要があります。jqueryでエレメントを選択してその幅を変更する
(function ITPscript() {
$(document).ready(function() {
$("#something table thead tr:nth-child(2)").width(1000);
});
})();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="something" class="aaa">
<table class="sortable">
<thead>
<tr>
<th>0</th>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
<th>G</th>
<th>H</th>
<th>I</th>
<th>J</th>
<th>K</th>
<th>L</th>
<th>M</th>
<th>N</th>
<th>O</th>
</tr>
</thead>
<tbody id="aBody">
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</tbody>
<tfoot></tfoot>
</table>
</div>
私は$("#something table thead tr:nth-child(2)").width(140);
を使用していますが、その作業はありません。要素を選択する適切な方法が必要です。
おかげで、私は要素を選択するために、TRと身体タブでn番目の子を使用していました。 –
あなたの "but"は ':nth-child'がどのように変更されているのかを変更しません。$("#iaBody tr ")。 https://developer.mozilla.org/en/docs/Web/CSS/:nth-child修飾子が付いていないコンテキストでは、 ':nth-child'は* any *要素を選択します。 'tr:nth-child() 'と同じではありませんが、 – deceze
と同じですが、がありましたが、メインコードのおかげで働いたが、私はまだ笑って混乱している –