0
I am rendering values in a table and I have to filter through a field that calls razao, for that I use a script
, query works but when deleting the query the previous values do not come back, ie when deleting the field search still persists.
HTML search:
<input type="text" value="" class="form-control pesquisa" style="max-width:200px" />
Js:
$(".pesquisa").keyup(function () {
var texto = $(this).val();
$(".lista").css("display", "grid");
$(".lista").each(function () {
if ($(this).find(".razao").text().toUpperCase().indexOf(texto.toUpperCase()) < 0) {
$(this).css("display", "none");
}
})
})
HTML list:
@if (Model != null)
{
foreach (var item in Model)
{
<tr class="lista" data-codigo="@item.codigo" data-razao="@item.razao">
<td class="col-sm-2 codigo" ><span>
@Html.DisplayFor(modelItem => item.codigo)</span>
</td>
<td class="col-sm-4 razao">
@Html.DisplayFor(modelItem => item.razao)
</td>
<td class="col-sm-2">
@Html.DisplayFor(modelItem => item.cidade)
</td>
<td class="col-sm-2">
@Html.DisplayFor(modelItem => item.estado)
</td>
<td class="col-sm-2">
@Html.DisplayFor(modelItem => item.telefone)
</td>
</tr>
}
}
Can someone help me?
Wow it is! Thank you so much for the help.. went unnoticed that hahahaha. Thank you even!!
– Um Programador