Return to Snippet

Revision: 47316
at June 5, 2011 05:13 by FatFolderDesigner


Initial Code
jQuery.expr[':'].Contains = function(a,i,m){
    return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;
};

Initial URL
http://fatfolderdesign.com/259/code/couple-of-jquery-selectors

Initial Description
This one was not created by me, but I can't remember who originally created it. It does the same thing as the built in <code>:contains()</code> selector with one important difference, it's case insensitive. Since I usually type in all lower case (bad habit I know) I like to use it for filters. It's also a nice one to use on name filters, that way if the person using the filter doesn't use the proper case it will still pull of the name, for example if they type in "Delsoto", but the proper capitalization is "DelSoto" the default <code>:contains()</code> won't find it, but this modified <code>:Contains()</code> will. Very convient.

If you have any questions about this selector, or happen to know who made tit, post and let me know. Use it in a cool project, do the same.

Initial Title
Case Insensitive contains jQuery selector

Initial Tags
jquery

Initial Language
jQuery