-2
Ex: word (ideal) if I type in the search the "i" it searches all the word that contains the letter "i", but if I type all the word the search disappears and is blank.
follows the code:
$('#myInput').keyup(function () {
var searchitem = $('#myInput').val();
if (searchitem == null || searchitem == undefined){
$('#table tbody td').show();
}
else {
searchitem = searchitem.toUpperCase();
$('#table tbody tr').hide();
$('#table tbody tr').each(function () {
if ($(this).text().indexOf(searchitem) >= 0) {
$(this).show();
}
});
}
});
Please edit the question and elaborate a [mcve]. At [Edit] take the opportunity to also describe how the code behavior should be when the word has only one letter (example: search for the word
é
).– Woss