Ich habe den folgenden Code, aber ich kann nicht sagen, warum es Spalten auf verschiedenen Tabellen versteckt. Es scheint, dass es den ersten Teil des Selektors ignoriert, der die Tabellen-ID ist.jQuery Verstecken von Spalten in verschiedenen Tabellen
<html>
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<table id="table1">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
<th>Col5</th>
<th>Col6</th>
<th>Col7</th>
</tr>
</thead>
<tbody>
<tr>
<td>Val1</td>
<td>Val2</td>
<td>Val3</td>
<td>Val4</td>
<td>Val5</td>
<td>Val6</td>
<td>Val7</td>
</tr>
</tbody>
</table>
<table id="table2">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
<th>Col5</th>
<th>Col6</th>
<th>Col7</th>
</tr>
</thead>
<tbody>
<tr>
<td>Val1</td>
<td>Val2</td>
<td>Val3</td>
<td>Val4</td>
<td>Val5</td>
<td>Val6</td>
<td>Val7</td>
</tr>
</tbody>
</table>
<table id="table3">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
<th>Col5</th>
<th>Col6</th>
<th>Col7</th>
</tr>
</thead>
<tbody>
<tr>
<td>Val1</td>
<td>Val2</td>
<td>Val3</td>
<td>Val4</td>
<td>Val5</td>
<td>Val6</td>
<td>Val7</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function() {
$('#table1 td:nth-child(4),th:nth-child(4)').hide();
});
</script>
</body>
habe ich versucht, diese Lösung zuerst https://stackoverflow.com/a/5901376/3658485
Bin ich die Tabelle auszuwählen gehen zu müssen, und seine th/tds iterieren?
Yep, das es war. Ich musste die Tabellen-ID nach dem Komma wieder einfügen. Das macht total Sinn. Vielen Dank. –