I have the following HTML code:
<div class="">
<table>
<tbody>
<tr>TITULO DO BOX</tr>
</tbody>
</table>
<table class="classeTable">
<tbody>
<tr>
<td>Esporte:</td>
<td>Futebol</td>
</tr>
<tr>
<td>Esporte:</td>
<td>Volei</td>
</tr>
<tr>
<td>Esporte:</td>
<td>Basquete</td>
</tr>
</tbody>
</table>
<div>
At the moment, I have several div
with no ID and within these div
I have 2 table
, the first table
has the BOX TITLE and that's it, already the second table
has the contents of the box but it has a class
that can help, but that same class
is used in several other places, then it could not be used as an identifier, what could be used, would be the
One solution would be:
$(".classeTable > tbody > tr:nth-child(1) > td:nth-child(2)").text();
$(".classeTable > tbody > tr:nth-child(2) > td:nth-child(2)").text();
$(".classeTable > tbody > tr:nth-child(3) > td:nth-child(2)").text();
But as I mentioned earlier, this class="classeTable"
is being used in many places, so jQuery would not know for certain which class="classeTable"
to choose.
Something like this would be ideal:
$("TITULO DO BOX .classeTable > tbody > tr:nth-child(1) > td:nth-child(2)").text();
$("TITULO DO BOX .classeTable > tbody > tr:nth-child(2) > td:nth-child(2)").text();
$("TITULO DO BOX .classeTable > tbody > tr:nth-child(3) > td:nth-child(2)").text();
But I'm not sure how to do this and if you can do that. Maybe it has some different way that I'm not aware of.