1
I’m having a problem with javascript, I took a js that does the search in the table, but when there are no records it just shows nothing, how do I put a "Return" with some sentence when there are no records,I tried a few times but without success. Follows:
// Write on keyup event of keyword input element
$("#search").keyup(function(){
_this = this;
// Show only matching TR, hide rest of them
$.each($("#table tbody").find("tr"), function() {
console.log($(this).text());
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) == -1)
$(this).hide();
else
$(this).show();
});
});
Where do you want to show this phrase? Instead of the table?
– Laerte
That, set the tfoot tag there in html with an id, and now when showing no result (which was not found), give an append there in tfoot
– Rafael Ribeiro
Take a look at my answer. =)
– Laerte