I have implemented a bootstrap filter for searching, but I am encountering an issue. Currently, when I type 'n', it displays all names containing 'n' like Nathan and Arjan. However, I would like it to only show names that start with 'n', such as Nathaan and Narima. Here is the blade.php code snippet:
<input class="form-control" id="myInput" type="text" placeholder="Search..">
<tbody id="myTable">
<tr>
<td>John</td>
</tr>
<tr>
<td>Anja</td>
</tr>
</tbody>
Here is my script portion:
<script>
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>