嗨,我试图为跨度列表制作过滤器,我无法将跨度中的内容转换为小写或忽略大小写。有任何想法吗?
$("#filterinput2").keyup(function () {
var filter = ($(this).val()).toLowerCase(); // get the value of the input, which we filter on
console.log("lower filter" + filter);
if (filter) {
// hide tr's for songs not matching and show tr's for songs matching
$(".tonelist").find(".song:not(:contains(filter))").parent().parent().parent().fadeOut("slow");
$(".tonelist").find(".song:contains(filter)").parent().parent().parent().fadeIn();
if (window.console != undefined) {
console.log($(".tonelist").find(".song:not(:contains(" + filter + "))").parent().parent().parent().innerHTML);
}
$(".tonelist").find(".grouptitle:not(:contains(" + filter + "))").parent().fadeOut("slow");
$(".tonelist").find(".grouptitle:contains(" + filter + ")").parent().fadeIn();
if (window.console != undefined)
console.log($(".tonelist").find(".grouptitle:not(:contains(" + filter + "))").parent().parent().parent().innerHTML);
} else
// if input field is empty, show all tr's
$(".tonelist").find("tr").fadeIn();
ColorLines();
});