2 回答

TA貢獻1816條經驗 獲得超4個贊
你應該在函數中添加它setlist。
function setlist (group) {
clearlist();
for (const person of group) {
const item = document.createElement("li");
item.classList.add("list-group-item");
const link = document.createElement("a");
link.href = "http://..."; // put here where the link should point
item.appendChild(link);
const text = document.createTextNode(person.name);
link.appendChild(text);
list.appendChild(item);
}
if (group.length === 0) {
setnoresults();
}
}

TA貢獻1825條經驗 獲得超6個贊
我通過這種方式獲得了解決方案,檢查搜索輸入是什么,如果是目標搜索,它將在自定義搜索上添加一個鏈接。如果陳述者正在做一切!
function setlist (group) {
clearlist();
for (const person of group) {
const item = document.createElement("li");
item.classList.add("list-group-item");
if (person.name === "?????????? ????????") {
const link = document.createElement("a");
link.href = "https://google.com"; // put here where the link should point
link.text = "?????????? ????????"
item.appendChild(link);
}
const text = document.createTextNode(person.name);
item.appendChild(text);
list.appendChild(item);
}
if (group.length === 0) {
setnoresults();
}
}
添加回答
舉報