5
I’m getting a full table from my server side, looking for td
with information I want and save that tr
integer in a variable as below:
var rowVoo;
$(table).find("tr td").each(function () {
if ($.trim($(this).text()) == "Porto Velho - RO") {
rowVoo = $(this).closest("tr");
}
});
The variable rowVoo
stays as it is below:
<tr>
<td>Porto Velho - RO</td>
<td>11</td>
<td>1 ( 9.1 %)</td>
<td>0 ( 0 %)</td>
<td>0 ( 0 %)</td>
</tr>
I have a list as abixus:
<ul class="list-voos">
<li><span></span> VOOS PREVISTOS</li>
<li><span></span> ATRASADOS AGORA</li>
<li><span></span> VOOS CANCELADOS</li>
<li><span></span> ATRASADOS NO DIA</li>
</ul>
I need to pass on the values that are within the td
for the span
who are on the list.
I’m looking for span
that are within the list:
var list = $(".list-voos").find("li").find("span");
And I try to iterate the values:
$(rowVoo).find("td").each(function () {
var that = $(this);
$(list).each(function () {
console.log($(this).text(that.text()));
return null;
});
});
But the values are doubled and the span
of the list always get the last value of the td
Thank you, it worked perfectly!
– Hermes Autran