mirror of
https://github.com/Llewellynvdm/front-end-frameworks.git
synced 2024-09-27 20:49:03 +00:00
25 lines
565 B
JavaScript
25 lines
565 B
JavaScript
$(document).ready(function(){
|
|
$("input#search").keyup(function(){
|
|
var query = $(this).val();
|
|
if (!query) {
|
|
$("#comparisonTable div.parent").show();
|
|
$("#noSearch").hide();
|
|
return;
|
|
}
|
|
var regex = new RegExp(query, "ig"), count = 0;
|
|
$("#comparisonTable div.parent:not(#noSearch)").each(function(){
|
|
if ($(this).text().search(regex) < 0) {
|
|
$(this).hide();
|
|
} else {
|
|
$(this).show();
|
|
count += 1
|
|
}
|
|
});
|
|
if (count == 0) {
|
|
$("#noSearch span").text(query)
|
|
$("#noSearch").show();
|
|
} else {
|
|
$("#noSearch").hide();
|
|
}
|
|
});
|
|
}); |