简体   繁体   中英

How to make jquery contains case insensitive on key up event

Im using jquery search from big static page using following code But this search act as case sensitive How can i change it to work for case insensitive also(ie Search music if user type MUSIC or music etc)

$(document).ready(function(){
$('.searchbig').keyup(function(){
     searchedText = $('.searchbig').val();

     var $grid = $(".grid").show();
     if( searchedText ) {
     $grid.filter(":not(:contains('"+searchedText+"'))").hide();
      }
     });
 });

尝试此...用大写字母保存数据,并让用户自由输入

searchedText.toUpperCase()

使搜索不区分大小写的一种方法是将值转换为小写。

searchText = $(".searchbig").val().toLowerCase();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM