更新时间:2022-06-19 09:24:48
嘿,jQuery中的内容有所不同.. https://api.jquery.com/jQuery.contains/
hey contains is different in jquery..https://api.jquery.com/jQuery.contains/
尝试:
var txt = $(this).text().toUpperCase();
var contains = (txt.indexOf(word) > -1);
那会给你一个包含的内容.
that'll give you a bool in contains.
编辑 这是您的新代码.
$(document).ready(function(){
$(".campo_filtro").keyup(function(){
word = $(this).val().toUpperCase();
$(".filtrar").each(function(){
if ($(this).text().toUpperCase().indexOf(word) != -1 ||
removeAcento($(this).text().toUpperCase()).indexOf(word) != -1){
$(this).fadeIn();
}else{
$(this).fadeOut();
}
});
});
});