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();
}
});
});


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM