Connect with me
Search
Twitter Feed
Navigation
« datejs - the javascript date library that will let you work with dates like a ninja | Main | ASP.NET Dynamic Data - Display Custom Text in a Foreign Key DropDownList/ComboBox »
Wednesday
Mar042009

jQuery 1.3 - Case Insensitive :contains()

Ran into a bit of an issue today when I upgraded the jQuery on a website I was working on to the new 1.3.2 version. I got the following error:

Object doesn’t support this property or method.

There is a fix for this. You will need to update your jQuery extension code to the following:

$.extend($.expr[":"], {
    "containsNC": function(elem, i, match, array) {
        return (elem.textContent || elem.innerText || "").toLowerCase
().indexOf((match[3] || "").toLowerCase()) >= 0;
    }
});

Now all is peachy clean (although this new script seems to perform slower than the old one. I will see if I can optimize it)

Reader Comments (11)

Updating libraries on a client project midstream
Hmmm :)

20 March 2010 | Unregistered CommenterJustin

Thanks! Saved me a few hours.

20 March 2010 | Unregistered CommenterAlex Petrscu

Great solution! Added into a filter solution for SharePoint and lists. Your code provided the best results!!!!

Tanks!!!

20 March 2010 | Unregistered CommenterPeter Allen

Thanks for solution! Works great!

20 March 2010 | Unregistered CommenterAndrew Kuroedov

Very nice, thanks.

27 May 2010 | Unregistered CommenterTerenn

Thanks!

22 June 2010 | Unregistered CommenterEsko

Thanks Man!! it works.

07 July 2010 | Unregistered CommenterAmol

Thanks!!

Saves some coding.

27 April 2011 | Unregistered CommenterTom Carnevale

I need the not contains function

How can i write??

Help me please

10 November 2011 | Unregistered CommenterSudhakarreddy

@Sudhakarreddy, look into the not function for jQuery

10 November 2011 | Registered CommenterEric Phan

Not working in IE9, any suggestions? Thanks!

28 April 2012 | Unregistered CommenterIvo

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>