0

I am using following code to test two table column values. only issue is how to convert .colNameivr values to upper case before matching with itemNames.

jQuery('.colNametns').each(function(i) {
var itemName = jQuery(this).text().toUpperCase();     //1
var match = jQuery('.colNameivr:contains("' + itemName + '")');  //2
  if(!match.length){
      jQuery(this).toggleClass('red');
      counter = i;
  }
if(match.length){
     alert(i+"--"+itemName );
    callme1(itemName);
  }          
 });

example here - http://jsfiddle.net/w7akB/53/
in above example -countryCode should not highlight as string is same.

sana
  • 460
  • 1
  • 10
  • 25
  • 1
    Refer to [this](http://stackoverflow.com/questions/2196641/how-do-i-make-jquery-contains-case-insensitive) – Zbigniew Jul 31 '12 at 16:07

1 Answers1

4
jQuery.expr.filters.icontains = function(elem, i, m) {
    return (elem.innerText || elem.textContent || "").toLowerCase().indexOf(m[3].toLowerCase()) > -1;
}

$("div:icontains('text')")

http://jsfiddle.net/SXsbP/

Esailija
  • 138,174
  • 23
  • 272
  • 326