I make a search button on my website, but I have a problem when I delete the text and the text field is empty, nothing is displayed, I want that if the text field is empty, all Items will be displayed. How can i do this?
$(document).ready(function () {
$("#searchdata tr").show();
$('#searchdata tr').each(function () {
$(this).attr('data-text', function () {
return $(this).text().toLowerCase();
});
});
$('#searchbtn').bind('change keypress keyup change', function () {
$("#searchdata tr").hide();
$('#searchdata tr[data-text*="' + $.trim($(this).val().toLowerCase()) + '"]').show();
});
});
And my website: www.ledai.ae/locations
source
share