我试图使用“包含”情况下不敏感。我试着使用解决方案在下面的stackoverflow问题,但它没有工作:
为了方便起见,将解决方案复制到此处:
jQuery.extend(
jQuery.expr[':'], {
Contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
这里是错误:
Error: q is not a function
Source File: /js/jquery-1.4.js?ver=1.4
Line: 81
这里是我使用它的地方:
$('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");
}
});
我使用原来大小写敏感的“包含”在同一场景下工作没有任何错误。有没有任何想法?我很感激。