jQuery allow uppercase and lowercase. Ignore letter case

I’m trying to get this jQuery live search to allow both lowercase and upper case but it does not work. it only works when there are not caps Any ideas on ow I can get it to work?

 $('input#sort-plate').keyup(function () {
        var value = $('input#sort-plate').val();

        var match = $(".act-employee-directory .name").filter(function() {
            // don't do this -> return $(this).text().match(new RegExp(value, "i"));
            return $(this).text().toLowerCase().indexOf(value) !== -1;
        });
        if (match.length) {
            $(".act-employee-directory").first().before(match.parent());
        }
        });

See complete code here

Could you just manipulate the string into all uppercase or lowercase? Remove the need for regex?

@RyanReese How do I implement that?

Set the value to lower case like you are with $(this).text().

1 Like

That did it. Thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.