I need the background of my TD to change according to the value it receives from the ListView coming from a query.
<scripttype="text/javascript" >
$(function () {
var texto = $("#ListaSchedulesRdc td:nth-child(4)").text();
var resultado = (texto);
//alert(resultado);
for (resultado in "#ListaSchedulesRdc") {
if (resultado > 1) {
$("#ListaSchedulesRdc td:nth-child(4)").css("background-image", "url(../Imagens/alerta-vermelho.png)", "background-repeat: no-repeat;", "class='alerta-vermelho'");
}
if (resultado = 1) {
$("#ListaSchedulesRdc td:nth-child(4)").css("background-image", "url(../Imagens/alerta-amarelo.png)", "background-repeat: no-repeat;", "class='alerta-amarelo'");
}
if (resultado = 0) {
$("#ListaSchedulesRdc td:nth-child(4)").css("background-image", "url(../Imagens/alerta-verde.png)", "background-repeat: no-repeat;", "class='alerta-verde'");
}
}
});
<asp:ListView ID="ListaSchedulesRdc" runat="server" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1" >
<LayoutTemplate>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><tableborder="1" ID="ListaSchedulesRdc">
<tr id="ListaSchedulesRdcTr">
<th>Nome </th>
<th>Ultima Rodada </th>
<th>Proxima Rodada </th>
<th>Ultimo Resultado </th>
<th>Quantidade Erros </th>
<th>Estado </th>
</tr>
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</tr>
</GroupTemplate>
<ItemTemplate>
<td><%# Eval("NomeTask") %> </td>
<td><%# Eval("UltimaRodadaTask") %> </td>
<td><%# Eval("ProximaRodadtaTask") %> </td>
<td id="ListaSchedulesRdcTd"><%# Eval("ResultadoTask") %> </td>
<td><%# Eval("ErrosTask") %> </td>
<td><%# Eval("EstadoTask") %> </td>
</ItemTemplate>
</asp:ListView>