I wanted to create a real-time search bar for bootstrap cards that don't use a database. I was able to get the real-time search done but it kept the spaces between invisible ones and filtered ones. This is the script I used to filter the cards out,
$(document).ready(function () {
$("#anythingSearch").on("keyup", function () {
var value = $(this).val().toLowerCase();
$("#myDIV .card").filter(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
All the cards are coded as,
<div id="myDIV">
<div class="row">
<div class="col-md-4">
<div class="card">...</div>
</div>
<div class="col-md-4">
<div class="card">...</div>
</div>
<div class="col-md-4">
<div class="card">...</div>
</div>
...
</div>
</div>
Before search:
After search:
Please tell me how to get rid of those spaces.