1

I'm trying to filter some divs by text. It works, but its case sensitive no matter i parameter. Any ideas why?

$('#acc_search_item input').on('keyup', function(){
        var text = $(this).val();
        console.log(text);
        $('.item').hide();
        $('.item').filter(function(){ return $(this).find('.iname').text().match("^.*"+text+".*","gi")}).show();
    });

1 Answer 1

4

You need to make it a regular expression:

match(new RegExp("^.*"+text+".*","gi"))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.