Posted By

FatFolderDesigner on 06/05/11


jquery selector

Versions (?)

Case Insensitive contains jQuery selector

 / Published in: jQuery


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 :contains() 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 :contains() won't find it, but this modified :Contains() 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.

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

Report this snippet  

You need to login to post a comment.