私は以下のコードを持っています。 #no-results要素は、結果が見つからない場合にのみ表示される必要があります。現在はIFの検索結果があります。jquery show div検索結果が返されない場合のみ
$('#no-results').hide();
$('#video-search-text').keyup(function() {
$('.video-search').hide();
$('#no-results').css("display", "none");
var txt = $('#video-search-text').val();
$('.video-search').each(function() {
if ($(this).text().toUpperCase().indexOf(txt.toUpperCase()) != -1) {
$(this).show();
}
else {
$('#no-results').css("display", "block");
}
});
});
私は、便宜上、以下のJSFiddleを作成しました。ありがとう
完璧!ありがとう! – James
喜んでお手伝いします:)これで問題が解決した場合は、それを承認済みとしてマークしてください。 –