Here是小提琴,我有搜索和工作良好,但我想改变现有的代码获取字母背景突出显示不是总字。只有字母背景亮点........需要在搜索上高亮字母
在这代码更改........
$("#search").keyup(function() {
value = $(this);
if (value.val() == "") {
$.each($("#ftz-table tbody tr td"), function() {
$(this).css('background-color', 'rgba(0,0,0,0)');
})
return;
}
$.each($("#ftz-table tbody tr td"), function() {
if (!($(this).text().toLowerCase().indexOf($(value).val().toLowerCase()) == -1)) {
$(this).css("background-color", "red");
} else {
$(this).css("background-color", "rgba(0,0,0,0)");
}
});
});
那你试试,到目前为止,造成这只是看起来像你花了一段代码,并希望得到的代码工作的一块,而无需实际做任何事情 – Icepickle
Stack Overflow是一个问答网站,而不是代码写作服务。 – secelite