0

I've read lots of suggestions on how to make contains case insensitive, but none seem to fit with what I've got. Sorry if I've missed the obvious.

I've got this.

var data = this.value.split(" ");
        $.each(data, function(i, v) {
            rows.filter(":contains('" + v + "')").show();
        });

How do I make it case insensitive ?

Thanks.

UPDATE

I've got this working using:

var data = this.value.split(" ");
    $.each(data, function(i, v) {
        rows.filter(":Contains('" + v + "')").show();
    });
});

jQuery.expr[":"].Contains = jQuery.expr.createPseudo(function(arg) {
return function( elem ) {
    return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
Tom
  • 1,436
  • 24
  • 50
  • What is `rows`? Can you give an example of what is in `data`? – Jamie Counsell May 11 '16 at 17:04
  • Hi this is what i'm working with : `http://jsfiddle.net/cpt43b9j/` it works fine but isn't case insensitive. – Tom May 11 '16 at 17:11
  • Can you explain why this is a duplicate ? I've explained what I'm trying to do and that I can't seem to get it to fit with what I've read. Thx – Tom May 11 '16 at 17:17

0 Answers0