I'm trying to use "contains" case insensitively. I tried using the solution at the following stackoverflow question, but it didn't work:
Is there a case insensitive jQuery :contains selector?
For convenience, the solution is copied here:
jQuery.extend(
jQuery.expr[':'], {
Contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
Here is the error:
Error: q is not a function
Source File: /js/jquery-1.4.js?ver=1.4
Line: 81
Here's where I'm using it:
$('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");
}
});
My use of the original case sensitive "contains" in the same scenario works without any errors. Does anyone have any ideas? I'd appreciate it.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…