ฉันมีสคริปต์ตัวกรองขนาดเล็กที่แสดงรูปภาพที่ติดแท็ก Alt แต่ฉันยังมี div ที่สามารถค้นหาได้ เพื่อการตรวจสอบที่ถูกต้อง ฉันไม่สามารถให้แท็ก alt แก่พวกเขาได้ ฉันต้องใช้ aria-label
ดังนั้น: ฉันจะค้นหาทั้งแท็ก alt และ aria-label ได้อย่างไร
//Search
$("#search").on("keyup", function () {
if ($(this).val().length >= 3) {
// hide everything,
$(".brand").hide();
$(".brandsslider").hide();
// get the text in the input
var mySelector = $(this).val();
// show any alt that contains the input
var myImgs = $("[alt*='" + mySelector + "' i]");
myImgs.show();
} else {
$(".brand").hide();
}
});