indexOf()不区分大小写用法

str.toLowerCase().indexOf(str.toLowerCase())>=0;

对字符串进行统一小写转换.

indexOf()查找到返回索引值大于=0;

未找到,返回-1;

input 输入框快速查找app

container.find('#searchName').keyup(function(){
var that = this;
var app = container.find('.pad-app');
$.each(app, function(idx, item){
$(item).hide();
});
var appname = container.find('.pad-app .pad-app-name');
$.each(appname, function(idx, item){
if($(item).html().toLowerCase().indexOf($(that).val().toLowerCase())>=0){
$(item).parent().show();
}
});
});
原文地址:https://www.cnblogs.com/MianShan/p/5979783.html