my_search = "sEarCh"; //global var, you can't pass arguments to the filter function my_search = new RegExp(my_search,'i'); // 'i' makes the regexp case insensitive
$('h1').filter(function () { return $(this).attr('title').match(my_search); }); this might be slow if you're handling large XML files, and it's limited to single word searches or exact concatenated matches. - ricardo On Sep 22, 6:27 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > Maybe try using filter and a regexp for the part that you want to be case > insensitive. Something like (very untested): > $(...).find('item').filter(function() { return this.name.match(new > RegExp(search, 'i')); }).each(function() { > > }); > > I don't recall the syntax for accessing an XML attribute from javascript, so > the "this.name" part might be wrong. Maybe you need $(this).attr('name') > instead. Also, you might want to be doing more than just passing the search > into a RegExp, but you get the idea. > > Also, maybe reconsider what you're trying to do. Maybe just return your xml > such that it's already been converted to lower case, then just do what you > were doing before except use search.toLowerCase() instead of just search. > > Hope it helps. > > --Erik > > On Mon, Sep 22, 2008 at 12:35 AM, blockedmind <[EMAIL PROTECTED]> wrote: > > > Nothing? > > > On Sep 20, 5:22 pm, blockedmind <[EMAIL PROTECTED]> wrote: > > > I am making search in an xml file, but I don't get expected results > > > since jQuery selectors arecase-sensitive. I use something like > > > > $(returnedXml).find("item[name*='"+search+"']").each(function(){ > > > > }); > > > > How to make it INCASE-SENSITIVE?