- Input Search
<div class="location-search-left"> <span class="left_search"><i class="fa fa-search"></i></span> <input type="text" id="filter" class="form-control" placeholder="Enter Your Address"> <span class="right_search"><i class="fa fa-location-arrow"></i></span> </div>
- JS
$("#filter").keyup(function() { // Retrieve the input field text and reset the count to zero var filter = $(this).val(), count = 0; // Loop through the comment list $('.storerw .col-12.my-3').each(function() { // If the list item does not contain the text phrase fade it out if ($(this).text().search(new RegExp(filter, "i")) < 0) { $(this).hide(); // Show the list item if the phrase matches and increase the count by 1 } else { $(this).show(); count++; } }); });
Jagdish Sarma Asked question October 29, 2021