diff --git a/static/index.js b/static/index.js index c0fac55..1b1db31 100644 --- a/static/index.js +++ b/static/index.js @@ -28,7 +28,7 @@ function renderItems() { clone.querySelector(".name").textContent = item.name; clone.querySelector(".content").textContent = item.content; clone.querySelector(".note").textContent = item.note; - clone.querySelector(".result").id = id; + clone.querySelector(".result").id = `item-${id}`; clone.querySelector("a").href = `form.html?id=${id}`; if (item.hidden) { clone.querySelector(".result").classList.add('hidden') @@ -69,7 +69,7 @@ function search(e) { const regex = new RegExp(query, 'i') for (const elem of document.getElementsByClassName('result')) { - const item = items[elem.id]; + const item = items[elem.id.substr(5)]; let found = false; if (query) { for (const a in searchAttrs) {