having issues with filtering my table. I want the entire row to be visible if the search comes up with any matches in its respective cells. Currently it is only showing exact cells.
<input type="text" id="searchText" />
<script type="text/javascript">
function contains(text_one, text_two) {
if (text_one.indexOf(text_two) != -1)
return true;
}
$("#searchText").keyup(function () {
var searchText = $("#searchText").val().toLowerCase()
$("tr td").each(function () {
if (!contains($(this).text().toLowerCase(), searchText))
$(this).hide();
else
$(this).show();
});;
});;
</script>
Im using this format for my MySqli table.
while($row = mysqli_fetch_array($result1, MYSQLI_ASSOC)):?>
<table border="1">
<!--<table class="fixed" border="1" cellpadding="1" cellspacing="1"> -->
<col width="100px" />
<col width="100px" />
<col width="100px" />
<col width="100px" />
<col width="100px" /><tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['posted'];?></td>
<td><?php echo $row['category'];?></td>
<td><?php echo $row['more'];?></td>
</tr>
<?php endwhile;
?>
</table>