Top of page
Main Content
(function($) {
$.expr[':'].Contains = function(a,i,m){
return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
};
$('#mySearch').bind('keyup',function(e){ if(e.keyCode == 13){ myFilter(); } });
$('#filter').bind('click keyup',function(){ myFilter(); });
$('#reset').bind('click keyup',function(){ $('#mySearch').val(''); myFilter(); });
function myFilter() {
$rc = $('#resultCount');
var keyword = $('#mySearch').val();
if(keyword == ''){
$('#faculty-list p').show();
$rc.find('.info').text('Displaying all faculty.');
$rc.hide();
return;
}
console.log(keyword);
var $matches = $('#faculty-list strong:Contains("'+keyword+'")');
$rc.find('.count').text($matches.length);
if( $matches.length > 0 ){
$('#faculty-list p').hide();
$matches.parent().show();
$rc.find('.info').text('');
}else{
$('#faculty-list p').show();
$rc.find('.info').text('Displaying all faculty.');
}
$rc.show();
}
})( jQuery );