0
我有3個搜索輸入,一個用於SN,一個用於TITLE,另一個用於DATE和I,以使它們在完美和諧中一起工作。使3個搜索輸入字段一起工作
Buuuuut,是不是這樣的現在..單獨他們的工作相當不錯,但同時在SN輸入按揭示艾倫和喜悅的行,在名稱輸入按壓Ø是足以抵消第一濾波器和只會顯示喜悅,因爲她是在SN ,並在名稱中Ø只有一個,它蘇格蘭人太...這不勝枚舉。
我該如何解決這個問題?
胖乎乎的JS
$(document).ready(function() {
$('#sn').keyup(function() {
var searchTerm = $(this).val().replace(/ /g, '').toLowerCase();
$(".sn").each(function() {
if ($(this).text().replace(/ /g, '').toLowerCase().match(searchTerm)) {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
$('#title').keyup(function() {
var searchTerm2 = $(this).val().replace(/ /g, '').toLowerCase();
$(".title").each(function() {
if ($(this).text().replace(/ /g, '').toLowerCase().match(searchTerm2)) {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
$('#date').keyup(function() {
var searchTerm3 = $(this).val().replace(/ /g, '').toLowerCase();
$(".date").each(function() {
if ($(this).text().replace(/ /g, '').toLowerCase().match(searchTerm3)) {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
});
謝謝! jsfiddle中的亂七八糟的字段發生在按Tidy顯然是在我的文件中導致他們是正確的。 – Alin