add prefix to item id when using as html id

prevents accidental re-use of html ids
This commit is contained in:
jomo 2022-08-05 02:13:23 +02:00
parent bde640c6e3
commit 4bf4f754c9

View file

@ -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) {