我正在尝试使用"包含"不区分大小写.我尝试在以下stackoverflow问题中使用该解决方案,但它不起作用:
为方便起见,此处将复制解决方案:
jQuery.extend(
jQuery.expr[':'], {
Contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
Run Code Online (Sandbox Code Playgroud)
这是错误:
Error: q is not a function
Source File: /js/jquery-1.4.js?ver=1.4
Line: 81
Run Code Online (Sandbox Code Playgroud)
这是我正在使用它的地方:
$('input.preset').keyup(function() {
$(this).next().find("li").removeClass("bold");
var theMatch = $(this).val();
if (theMatch.length > 1){
theMatch = "li:Contains('" + theMatch + "')";
$(this).next().find(theMatch).addClass("bold");
}
});
Run Code Online (Sandbox Code Playgroud)
我在同一场景中使用原始区分大小写的"包含",没有任何错误.有没有人有任何想法?我很感激.