I have a function for searching. But the problem is that I have to type in the exact word with uppercase and lowercase for the result. I want to change the function so that it doesn't matter the upper lowercase. Here is the function:
$("#search-chats").keyup(function(event) {
        var chatls = $(".chat-list").find('ul');
        var uname  = $(this).val();
        var found  = new Array();
        if (uname.length > 1) {
            chatls.find('span.username').each(function(index, el) {
                var username = $(el).text();
                if (username.indexOf(uname) == -1) {
                    $(el).closest('li').addClass('hidden');
                }
            });
        }
        else{
            chatls.find('li').removeClass('hidden');
        }
    });
 
     
    