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