我写了这个JS代码
$("#itemSearch").on("keyup", function () {
if ($("#itemSearch").val().trim() == '') {
$(".card-content").show();
}
else {
var value = $(this).val().trim().toLowerCase() ;
$(".card-group").filter(function () {
$(this).toggle($(this).text().trim().toLowerCase().indexOf(value) > -1)
});
}
});
并想说这样的话。
$(".card-group"):not.text()
alert ("1");
或者
$(".card-group").text ! value
alert("1");
有谁可以帮助也许?
问候Erya
我现在知道答案了。它与include()一起工作!
$("#itemSearch").on("keyup", function() {
if ($("#itemSearch").val() == '') {
$(".card-content").show();
showPage(1);
$(".pagination").css("display", "flex");
}
else {
var value = $(this).val().toLowerCase();
$(".card-group").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
$(".pagination").css("display", "none");
**if ($(".card-group").text().toLowerCase().includes(value)) {
alert ("1");
}
else {
alert ("2");
}**
}
});