Here is my jQuery to search on div items, i am getting the search results correctly but when there is no text match it should display a message like no search results
$(document).ready(function(){
$('#search').keyup(function(){
// Search text
var text1 = $(this).val();
var text = this.value.toUpperCase();
var text2 = this.value.toLowerCase();
// Hide all content class element
$('.panel').hide();
// Search and show
$('.panel:contains("'+text+'")').show();
$('.panel:contains("'+text1+'")').show();
$('.panel:contains("'+text2+'")').show();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="panel panel-custom" style="visibility: visible; display: block;">
<div class="panel-heading" role="tab" id="headingtwentyfour">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapsetwentyfour" aria-expanded="false" aria-controls="collapsetwentyfour">
<i class="glyphicon glyphicon-plus"></i>
I attend the same training 2 years back, am I allowed to attend it again?
</a>
</h4>
</div>
<div id="collapsetwentyfour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingtwentyfour">
<div class="panel-body animated zoomOut">
The participant need not attend any course more than once until his/her validity of the certificate is minimal for which they can't take up a refreshment course.
</div>
</div>
</div>