Mögliche Duplizieren:
How to iterate a table rows with JQuery and access some cell values?jQuery jede Schleife in Tabellenzeile
Ich habe so etwas wie:
<table id="tblOne">
<tbody>
<tr>
<td>
<table id="tblTwo">
<tbody>
<tr>
<td>
Items
</td>
</tr>
<tr>
<td>
Prod
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
Item 1
</td>
</tr>
<tr>
<td>
Item 2
</td>
</tr>
</tbody>
</table>
ich jQuery Schleife durch jede tr geschrieben haben wie :
$('#tblOne tr').each(function() {...code...});
Aber Problem ist, dass es durch die "tr" von "tblTwo" auch Schleifen, die ich nicht will. Kann jemand bitte etwas vorschlagen, um dies zu lösen?
@Raynos bitte erklären, statt "hit-and-running" ... –
Wie verweise ich auf die tr Element innerhalb der Funktion? – jumxozizi
@Rubiksmmo - verwenden Sie Funktion (Index, Element) - https://api.jquery.com/each/ – FrenkyB