I'm trying to filter some divs by text. It works, but its case sensitive no matter i parameter. Any ideas why?
$('#acc_search_item input').on('keyup', function(){
var text = $(this).val();
console.log(text);
$('.item').hide();
$('.item').filter(function(){ return $(this).find('.iname').text().match("^.*"+text+".*","gi")}).show();
});
您需要使其成为正则表达式:
match(new RegExp("^.*"+text+".*","gi"))
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.